react-router
react-router copied to clipboard
Parent Context not propagated to children
I have the following router configuration
<Router history={history}>
<Route path ="/" component={FrontendApp}>
<Route path ="login" component={Login}/>
<Route path ="unauthorized" component={Unauthorized}/>
<IndexRoute component={Index}/>
</Route>
<Route path="/main" component={MainMenu}>
<IndexRoute component={MainMenuIndex}/>
</Route>
</Router>
I am using Material Ui http://material-ui.com/#/ and one of the requirement is to define a theme in the parent context and it will automatically available to the children as well.
Declared at FrontendApp.js
childContextTypes: {
muiTheme: React.PropTypes.object
},
getChildContext: function() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
},
on Login.js
Any reference to this.context.muiTheme is null?
Im using V1.0.0RC I dont have this problem in V0.13.3
You probably need to use React 0.14 to get parent-based context.