I have a left rendered on a Dashboard
component, and beside that a placeholder for the currently selected page. The links change the URL as expected e.g. dashnoard/permissions
, but the Permissions component is not rendered. It will work if the page is refreshed manually, though. Here is what I'm trying now.
class App extends Component {
render() {
return (
<Router>
<MultiThemeProvider>
<div className="App" id="siteWrap">
<AppBar title="DiversityEDU" />
<switch>
<Route exact={true} path="/" component={Home}/>
<Route exact={true} path="/login" handler={Login} component={Login}/>
<Route path="/dashboard" component={Dashboard}/>
</switch>
</div>
</MultiThemeProvider>
</Router>
);
}
}
class Dashboard extends Component {
constructor(props){
super(props);
}
render() {
return (
<Router>
<div id="dashboardWrap" style={style.dashboardWrap}>
<Sidebar links={links}/>
<div style={style.dashboardContent}>
<p>Dashboard has rendered</p>
<switch>
<Route exact={true} path="/dashboard/roles" component={Roles}/>
<Route exact={true} path="/dashboard/permissions" component={Permissions}/>
</switch>
</div>
</div>
</Router>
);
}
}
I am using Redux in this project as well, but not directly in the components above, yet.
const AppContainer = connect(
mapStateToProps,
mapDispatchToProps
)(App);