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

Enable Multiple Routes to same component #3478

Closed
wants to merge 3 commits into from
Closed

Enable Multiple Routes to same component #3478

wants to merge 3 commits into from

Conversation

rodrigobacelli
Copy link

@rodrigobacelli rodrigobacelli commented May 18, 2016

Here at work we needed to use some different pathnames and render the same component. The solution repeating s to was a little hard to maintain and understand the routes. Thinking in this, we developed a solution to render the same component using different paths separated by pipes.

Instead of using:

    <Route path="/" component={App}>
      <IndexRoute component={Index}/>
      <Route path = "myaccount" component={Account} />
      <Route path = "my-account" component={Account} />
      <Route path = "account" component={Account} />
    </Route>

Now we candeclare just one component:

    <Route path="/" component={App}>
      <IndexRoute component={Index}/>
      <Route path = "myaccount|my-account|account" component={Account} />
    </Route>

All tests has passed and I wrote some more to test if everything was working fine

@taion
Copy link
Contributor

taion commented May 18, 2016

We'd prefer not to extend the matching syntax in this manner. Instead, we want to do something more general purpose – some combination of #3098 and #3105, possibly configured on a per-route level. See discussion on those threads, and on #2286.

@taion taion closed this May 18, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 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

Successfully merging this pull request may close these issues.

2 participants