When using react-router (version 3), I was able to create nested routes, as the wrapper component received the children. I was able, this way, the use a "global" reducer for the root component, as every child component had it's own reducer:
<Provider store={store}>
<Router key={Math.random()} history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={MainPage}/>
<Route path="mainPage" component={MainPage}/>
<Route path="secPage" component={SecPage}/>
<Route path="*" component={MainPage}/>
</Route>
</Router>
</Provider>
And inside the root component:
render() {
return (
<div className="app-wrapper">
{this.props.children}
</div>
);
}
I upgraded the router to use version 4:
<Provider store={store}>
<Router history={history}>
<div>
<Route exact path="/" component={MainPage}/>
<Route path="secPage" component={SecPage}/>
<Route path="mainPage" component={MainPage}/>
</div>
</Router>
</Provider>
And as you can see- my routes are now "Flat", so I can't really use the root component, and therefor need the use the "globalReducer" for each Component.
How can I use the same method as before? or at least something close to it?