Last active
August 10, 2018 14:11
-
-
Save sagiavinash/e4980549658301db526ae9cdd4e6e3d2 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
// HomePageContainer.js | |
import storeManager from 'react-store-manager'; | |
import homeReducer from './homeReducer'; | |
storeManager.registerReducers({ home: homeReducer }); | |
export default connect(/* mapStateToProps, mapDispatchToProps */)(Page); | |
// ProductListPageContainer.js | |
import storeManager from 'react-store-manager'; | |
import productListReducer from './productListReducer'; | |
storeManager.registerReducers({ productList: productListReducer }); | |
export default connect(/* mapStateToProps, mapDispatchToProps */)(ProductListPage); | |
// AppContainer.js | |
import storeManager from 'react-store-manager'; | |
const HomeRoute = Loadable({ | |
loader: import('./HomePageContainer'), | |
loading: () => <div>Loading...</div> | |
}); | |
const ProductListRoute = Loadable({ | |
loader: import('./ProductListPageContainer'), | |
loading: () => <div>Loading...</div> | |
}); | |
function AppContainer({login}) { | |
return ( | |
<App login={login}> | |
<Switch> | |
<Route exact path="/" component={HomeRoute} /> | |
<Route exact path="/products" component={ProductListRoute} /> | |
</Switch> | |
</App> | |
); | |
} | |
export default connect(/* mapStateToProps, mapDispatchToProps */)(AppContainer); | |
// Root.js | |
import storeManager from 'react-store-manager'; | |
import AppContainer from './AppContainer'; | |
export default function Root() { | |
return ( | |
<Provider store={storeManager.createStore(/* initialState, enhancer */)}> | |
<AppContainer /> | |
</Provider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment