I want to achieve code splitting of every main route so every page will have its own file (along with its subcomponents), for example I have a main render function with Route
components that points to containers:
<Route path={`path1`} component={foo.container} />
<Route path={`path2`} component={bar.container} />
Each container looks something like this:
const mapDispatchToProps = {
... actions etc ...
}
const mapStateToProps = (state) => ({
... selectors etc ...
})
const withConnect = connect(mapStateToProps, mapDispatchToProps);
export default compose(withConnect)(MyComponent);
I tried to wrap a container and reference that in the route but it didn't work:
export default Loadable({
loader: () => import('./MyContainer'),
loading() {
return (<div>Loading...</div>)
},
});
So what am supposed to wrap then?