Week 7 — 13 / 16

Lab 7: React Tic Tac Toe

Props

  • Calls a component's render method any time they change
  • Read-only to support one-directional data flow: https://medium.com/@lizdenhup/understanding-unidirectional-data-flow-in-react-3e3524c09d8e

State

  • useState makes a bargain with React: I promise to only update the state with the assigned setter method, and React promises to efficiently re-render my component and its children.
  • Update with this.setState()
  • When you call setState in a component, React automatically updates the child components inside of it too.
  • To let child components modify state, pass a handler function down to them as one of their props.