Demystifying Higher order components and Render Props
Higher order components (HOC) and render props are two advanced react patterns which help in reusability and composition of components. Both of them can easily be interchanged in their respective use cases, but they do have fine lines of distinction. I wish to explain the use cases of HOC and RPs and their respective pros and cons so that you can apply them to your daily code as need be.
Breaking down the talk into points and sub points
- What are higher order functions, very minimal example to explain the concept
What are Higher Order components, when should you use a higher order component
a. Why did higher order components come into being
b. Example of a Higher order Component as a presentational component for rendering initial data for server side rendering
c. Common examples, compose, recompose of redux
What are Render props, when should you use a render prop
a. Example of a render prop being used for rendering initial data for server side rendering
b. Composing multiple components together with Render props
c. Common examples, withRouter of react router
Differences between HOC and RPs
Pros and Cons of each, differences, when to use either?
Some idea of how components are reused in react.
React to Vue