React的两个重要属性 props和state
- Properties - we pass these values when we create a component. They don't change during the component's lifecycle.
- State - these values can change over entire life of the component.When you change some value in
state
object, React will re-calculate therender
method and update the HTML to match the new state (in this case, updating the class).
普通回显小技巧 如果在input中绑定onChange
事件 event.target.value
就可以得到输入框的值