![8228e8cbec86270686ccce2908792ca7.png](https://i-blog.csdnimg.cn/blog_migrate/a5798c155da2006abb94a48a74c4ea2a.jpeg)
一、数据绑定
类似 Vue 的 v-model,
this.state = { val: 1, companies: ["阿里巴巴", "腾讯", "百度", "京东"], };companyNameUpdate(e) { this.setState({ companyName: e.target.value }) }
本例中,由于 React 是单向数据绑定,所以还要额外增加 onChange 函数来实时获取输入框中的值
一、遍历
类似 Vue 的 v-for,通过 js 的 map 操作
{ this.state.list.map((item,index)=>{ return {item} }) }
三、绑定事件
如使用 onClick,即点击时的事件,类似 Vue 的 @change
增