React的兩個(gè)重要屬性 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
就可以得到輸入框的值