Skip to content

Instantly share code, notes, and snippets.

@osmelmora
Last active September 18, 2017 17:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save osmelmora/e9564947bde7463ddb2d51bcbdf44273 to your computer and use it in GitHub Desktop.
Save osmelmora/e9564947bde7463ddb2d51bcbdf44273 to your computer and use it in GitHub Desktop.
// 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