React 快速回顾

2017-02-23  本文已影响0人  前端xiyoki

React Element

基本用法
注意事项

components

基本用法
注意事项

props

基本用法
注意事项

state

基本用法
注意事项

lifecycle hooks

注意事项

refs

基本用法
注意事项

ref 回调比componentDidMount更早调用。

React Event

基本用法
注意事项

Lists

基本用法

Form

基本用法

Lifting State Up

基本用法
  1. 在父组件上设置共享state,子组件上不设置。
  2. 将父组件上的共享state作为prop向下传递给子组件,初始化子组件的状态。
  3. 将父组件中的onChange处理程序作为prop向下传递到子组件对应事件处理程序中并由其调用,并将表单元素实时更新的可变状态作为参数传入,以同步更新父组件中的状态。handleChange(e) {this.props.onChange(e.target.value);}

children

基本用法
上一篇 下一篇

猜你喜欢

热点阅读