Data: State V Props - LucyMHall/Fizzy_O GitHub Wiki

  • props and stats are both bits of data used by a component
  • props are bits of data which are set when the component is first made/ called
  • state is data that changes, initialize state in the constructor of the component and then call setState when you want to change it
    • more about setState(updater[, callback]):
      • changes the component state and tells react that it needs to be re-rendered with the updated state
      • use it to change user interface in response to event handlers and server responses
      • what do we mean by the updater? - it is the function

https://reactjs.org/docs/react-component.html#setstate