Answer the question
In order to leave comments, you need to log in
How to fix The root route must render a single element error in react router?
An error occurs
Uncaught Error: The root route must render a single element(…) browser.js:40
const rootRoute = {
childRoutes: [{
path: '/',
component: require('./App'),
childRoutes: [
require('./../routes/сalendar'),
]
}]
}
ReactDOM.render(
<Router history={browserHistory} routes={rootRoute} />,
document.getElementById('root')
);
class App extends Component {
render() {
return (
<MuiThemeProvider>
<Container />
</MuiThemeProvider>
);
}
}
module.exports = {
path: 'calendar',
getComponent(location, cb) {
require.ensure([], require => cb(require(`./components/Calendar`).default));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question