Render props

September 5th, 2024//Ep. 195

Sam and Ryan talk about render props in React. They discuss where they came from, how Hooks superseded them for sharing stateful logic, how data attributes compare to them for customizing styling, and how for certain complex components like forms they're still a great solution for accessing slices of internal state.

Timestamps

  • Intro
  • Where did render props come from?
  • How hooks replaced many use cases for render props
  • Using render props for custom styling
  • Data attributes vs. render props for custom styling
  • Using render props to peek into an uncontrolled component's internal state
  • Forms example and using render props for a smaller public API
  • React docs mention of render props
  • Where render props shine