-
-
Save rubenspgcavalcante/3294b7aca5bfb3a67175d5ff61b82ab5 to your computer and use it in GitHub Desktop.
Using React.lazy to return a lazy container
This file contains 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
import React from "react"; | |
import { connect } from "react-redux"; | |
export default (mapStateToProps, dispatchMappingPromise, ...rest) => Component => | |
React.lazy(() => | |
dispatchMappingPromise.then(mapDispatchToProps => ({ | |
default: connect( | |
mapStateToProps, | |
mapDispatchToProps, | |
...rest | |
)(Component) | |
})) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment