React at Preact

Dumb vs. Smart vs. Pages

Quick Ref

Dumb Components

  • DO bind to DOM events
  • DO use ref so that event bindings can fetch data from the DOM and pass it up to parent callbacks.
  • DO NOT use state for data (UI behaviors only)
  • DO NOT know about Stores
  • DO NOT know about url routes or what page they are on

Smart Components

  • DO have data in state
  • DO bind to changes in Stores
  • DO call Actions to make changes to data
  • DO pass data to children components as props

Pages

  • Smart Components rules, plus:
  • DO know about url routes
  • DO NOT know about the generated DOM in child components