Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Imagine what would it be if connect, withRouter, injectIntl were child as function
export default (
<Connect mapStateToProps={mapStateToProps} mapPropsToActions={actions}>
{
(props) => (
<WithRouter>
{
(router) => (
<InjectIntl>
{(intl => <SomeComonent intl={intl} router={router} {...props} />}
</InjectIntl>
)
}
</WithRouter>
)
}
<Connect />
)
// VS HOCs
export default compose(
connect(mapStateToProps, actions),
withRouter,
injectIntl
)(SomeComponent);
// Every pattern has use cases :P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment