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

how to figure from route component if the child index route is active, or which child route is active #2891

Closed
jedwards1211 opened this issue Jan 13, 2016 · 4 comments

Comments

@jedwards1211
Copy link

Hopefully this question will illuminate a lack of clarity in the documentation.

I have this in my route config:

        <Route path={API_TOKENS_PATH} component={DrilldownRoute}>
          <IndexRoute component={ReduxAPITokensView}/>
          <Route path=":apiTokenId" component={ReduxAPITokenView}/>
        </Route>

I'm trying to create DrilldownRoute so that it will animate transitions to and from the index and child routes.

I have read the API docs and looked at the props passed into my components in the React dev tools, and I am absolutely in the dark about the following. In version 2.0.0, how would I determine, from the render() method of the DrilldownRoute, if:

  • The IndexRoute is active (and no child routes)
  • A child route is active and which one

The method must work regardless of whether the above routes are under the app root or nested arbitrarily deep inside of other routes.

@taion
Copy link
Contributor

taion commented Jan 13, 2016

Thanks for your question!

We want to make sure that the GitHub issue tracker remains the best place to track bug reports and feature requests that affect the development of React Router.

Questions like yours deserve a purpose-built Q&A forum. Could you post this question to Stack Overflow with the tag #react-router? https://stackoverflow.com/questions/ask?tags=react-router.

We also have an active and helpful React Router community on Reactiflux, which is a great place to get fast help with React Router and with the rest of the React ecosystem. You can join at https://discord.gg/0ZcbPKXt5bYaNQ46.

@taion taion closed this as completed Jan 13, 2016
@jedwards1211
Copy link
Author

How about clearer documentation of how to determine if a route is active?

@timdorr
Copy link
Member

timdorr commented Jan 13, 2016

We want to build better overall docs very soon (in time for, or shortly after, 2.0.0 releases), which would include better documentation on the whole active state and checking for it in your components.

@jedwards1211
Copy link
Author

Okay, thank you!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
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

3 participants