Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Ignore missing components in deeply nested routes #243

Closed
twheys opened this issue Sep 26, 2016 · 1 comment
Closed

Ignore missing components in deeply nested routes #243

twheys opened this issue Sep 26, 2016 · 1 comment

Comments

@twheys
Copy link

twheys commented Sep 26, 2016

Hi, I would like to nest routes reflecting my URL structure with route levels in between but I don't need a component at every level. Would it be possible to ignore missing components when deeply nesting them in order to make a structure like the following?

<Router history={browserHistory}>
    <Route path="/" component={Container}>
        <Route path="/feature">
            <IndexRoute component={ListPage}/>
            <Route path="/create" component={EditPage}/>
            <Route path="/:pk">
                <IndexRoute component={DetailsPage}/>
                <Route path="/edit" component={EditPage}/>
            </Route>
        </Route>
    </Route>
</Router>

Here we expose a couple URLs:

  1. /feature <- a list of feature entities
  2. /feature/create <- Create page for a new entity
  3. /feature/23 <- Details page for entity
  4. /feature/23/edit <- Edit page for existing entity

However, it's not necessary to add a component to the view for every level here, so by omitting a component, it should be ignored.

@twheys
Copy link
Author

twheys commented Sep 26, 2016

Sorry, meant to post this as an issue for react-router, not the tutorial. Closing.

@twheys twheys closed this as completed Sep 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant