import React, { Component } from 'react' ; class App extends Component { constructor(props) { super (props); this .state = {num:1} } changeNum(e){ this .setState({num:e.target.value}) } render() { return ( <div classname= "App" > <input type= "text" value= "{this.state.num}" onchange= "{this.changeNum.bind(this)}/" > <h1>{ this .state.num}</h1> </div> ); } } export default App; |