const Input = (props) => (
<input type="text" onChange={props.handleChange} />
)
const Output = (props) => (
<div>{props.text}</div>
)
class App extends React.Component {
constructor (props) {
super(props)
this.state = {}
this.handleChange = this.handleChange.bind(this)
}
handleChange (e) {
this.setState({
value: e.target.value
})
}
render () {
return (
<div>
<Input handleChange={this.handleChange} />
<Output text={this.state.value} />
</div>
)
}
}