The InputField & Button are custom components that go into a form to create a form. My issue is how do I send the data back up to form so that
Parent.js
import React, { Component } from 'react';
import Child from './child'
class Parent extends Component {
state = {
value: ''
}
onChangeValueHandler = (val) => {
this.setState({ value: val.target.value })
}
render() {
const { value } = this.state;
return (
the value is : {value}
);
}
}
export default Parent;
Child.js
import React, { Component } from 'react';
class Child extends Component {
render() {
const { value , onChangeValue } = this.props;
return (
);
}
}
export default Child;
you can see a live example on : https://codesandbox.io/s/two-way-binding-qq1o1?from-embed