Compose Multiple Higher Order Components Together using Recompose

InstructorTim Kindberg

Share this video with your friends

Send Tweet

Learn how to use the 'compose' function to mix together HOCs, even ones from other libraries like 'connect' from redux.

Austin Witherow
~ 7 years ago

I notice the use of the setPropTypes within one of the HOCs. How could I integrate flow typing instead of propTypes to such a HOC?

Peramanathan Sathyamoorthy
~ 7 years ago

To be precise you should have

const enhance = compose( connect(), setPropTypes({ name: React.PropTypes.string.isRequired, status: React.PropTypes.string }), setDisplayName('User') );

The order of execution in compose is reverse

Ray Dai
~ 7 years ago

Did the dispatch prop being initialized in connect and pass on implicitly?

Logan Powell
~ 7 years ago

Would love to see some coverage of the Obeservables HOCs from Recompose :)