Props

CSS Tricks — Props and PropTypes in React

  • props are data passed between components — more specifically, from parent to child component.
  • Example: passing functions as props.
  • PropTypes ensure that the right type of props is passed to a component — and, conversely, that the receiving component is receiving the right type of props.

Aditya Agarwal — Understanding React render props and HOC

  • Render props allow a data-fetching component to call various rendering components, so they’re more reusable.
  • HOC (higher order components) define a data-fetching component within a function, so a rendering component is passed as an argument of the function call.
  • Similar outcomes. Now “hooks” can do this in React.

CSS Tricks — Render Props in React

  • Example: a Component using a render prop
  • Example: fetching data with a render prop