今天开始学习了react,写此博客记录一些笔记
import React ,{ Component,Fragment} from 'react'
class TodoList extends Component {
constructor(props){
super(props);
this.state = {
inputVale:'',
list:[]
}
}
render(){
return(
<Fragment>
<div>
<input
value={this.state.inputVale}
onChange={this.handleInputChange.bind(this)}
/>
<button>提交</button>
</div>
<ul>
<li></li>
</ul>
</Fragment>
)
}
handleInputChange(e){
// console.log(e.target.value)
// console.log(this)
this.setState({
inputVale:e.target.value
})
}
}
export default TodoList;