Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris
What is the Render props pattern? The Render props pattern ...
For further actions, you may consider blocking this person and/or reporting abuse
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 theDumb
component that just does rendering according to the props.As an example:
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!
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, dev.to/softchris/hooks-for-react-j... 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.