Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to do dynamic loading with redux-router #284

Open
joeyzhao0113 opened this issue Jan 22, 2017 · 1 comment
Open

Failed to do dynamic loading with redux-router #284

joeyzhao0113 opened this issue Jan 22, 2017 · 1 comment

Comments

@joeyzhao0113
Copy link

Version

2.1.2

Steps to reproduce

Create a router like below:

const rootRouter = {
    childRoutes:[{
      path:'/root',
      component:MainEntry,
      childRoutes: [
        require('../containers/main_entry')
      ]
    }]
  }

 return <Router history={hashHistory}>
    <ReduxRouter>
    {rootRouter}
   </ReduxRouter>
</Router>

but when loading the page, I got below error:

Objects are not valid as a React child (found: object with keys {childRoutes}). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons.

Expected Behavior

Actual Behavior

@joeyzhao0113
Copy link
Author

I tried to use below code to put route as the value for prop in <ReduxRouter> but it doesn't work. None of the router is recognised by react. I will get a blank page with this error [react-router] Location "/" did not match any routes

<Router history={hashHistory}>
    <ReduxRouter prop={
      <Route key="root" name="root" path="/root" component={MainEntry}>
        <IndexRedirect to='/'/>
        <Route path="/" component={MainComponent} onEnter={auth}/>
      </Route>
    }>
    </ReduxRouter>
  </Router>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant