Last active
September 18, 2017 17:46
-
-
Save osmelmora/e9564947bde7463ddb2d51bcbdf44273 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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