The amazing Render props pattern for React.js — lifecycle begone!

Chris Noring on June 10, 2019

Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris What is the Render props pattern? The Render props pattern ... [Read Full]
markdown guide

I use this pattern all the time but using different names.
Usually I create a Container component that implements the behaviour (and do more stuff like redux store connection) and pass properties to the Dumb component that just does rendering according to the props.

As an example:

function SomeContainer (props) {
  const onContinue = useCallback(() => {
    console.log('Just clicked');

  return <SomeComponent onContinue={onContinue} />

function SomeComponent (props) {
  const { onContinue } = props;

  return (
      <span>You can continue now</span>
      <button onClick={onContinue}>Continue</button>

I really think you are doing new developers a disservice (probably old as well) by writing about render props. As of react hooks, this pattern is no longer needed and not a best practice, with hooks at least! Which is the recommended approach :-)


Hi Jonathan. This article is several months old. ( Syndicated from a medium post ). I do have an article about Hooks as well, I reason like this: the adoption of Hooks doesn't seem to be so fast yet and meantime people still need to maintain their codebases.


Although I understand higher-order components (HOC) and have used them (mainly Redux), I always found them difficult to read and there is also a risk of overwriting props on the component being wrapped in the HOC.

Render props communicate better what's being used/available as props. And it separates functionality from UI potentially. A great example of this is Kent C. Dodds' Downshift.

Looking forward to your next post!

code of conduct - report abuse