programmer
programmer

Reputation: 332

Different routes for same component

I am using React-router for routing in my reactjs web app. I want a set of different routes to render same component.

For example:

http://example.com/abc
http://example.com/xyz
http://example.com/pqr

These all URIs will render same component

Note: I dont want all routes to render same component. I just want abc , xyz and pqr to render same component

Upvotes: 0

Views: 584

Answers (1)

Tugrul
Tugrul

Reputation: 1808

Just define them,

<Router history={browserHistory}>
    <Route path="/" component={App}>
      <Route path="abc" component={YourComponent}/>
      <Route path="xyz" component={YourComponent}/>
      <Route path="pqr" component={YourComponent}/>
      <Route path="*" component={NoMatch}/>
    </Route>
  </Router>

Upvotes: 2

Related Questions