Compose Multiple Higher Order Components Together using Recompose

Tim Kindberg
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
Austin Witherow
~ 4 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
Peramanathan Sathyamoorthy
~ 4 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
Ray Dai
~ 4 years ago

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

Logan Powell
Logan Powell
~ 3 years ago

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