Linked Questions

0 votes
2 answers
475 views

Is it possible to use optional parameter for url? For example path fruits/:id will match the same component if parameter id is not passed; <Route path="/fruits/:id"> <Fruits /> ...
user avatar
2 votes
1 answer
76 views

<Route path="/etc/:id/"> <Component /> </Route> I notice, if :id is not provided, then it wouldn't match. How do I change it so that :id is optional?
Bear Bile Farming is Torture's user avatar
49 votes
6 answers
37k views

In v5, we could add trailing ? to route for optional parameters, but as in v6, the support for the same has been dropped, so what's the alternate way of writing the following piece of code? <Route ...
ShadowLeaf's user avatar
15 votes
2 answers
7k views

I'm a bit stuck with the route component. Imagine I have this two Routes with their own path: <Route path='/person/add' exact component={PersonForm}/> <Route path='/person/:id' exact ...
Wannes's user avatar
  • 1,069
13 votes
2 answers
7k views

Need to declare an optional path that contains a string and a parameter Now I have this path <Route exact path="/tasks/:id" render={(props) => ( <AsyncTask {...props} profile={this.state....
Andrei L's user avatar
  • 3,701
7 votes
1 answer
20k views

I have a path as <Route path="/account/:accountid/LoginPage" component={LoginPage}/> This works fine if the url is -> /account/12332/LoginPage. I want to have optional query parameters. ...
Geeky's user avatar
  • 7,514
10 votes
1 answer
6k views

Let's say I have the following 2 routes: ... <Route exact path="/:param1?/" component={Home}/> <Route path="/news" component={News}/> ... now when I try to hit route /news ...
henk's user avatar
  • 2,868
6 votes
1 answer
10k views

I'm trying to create a route that matches all of the following URLs: /product/foo /product/foo/bar Here's my current route: <Route path="/product/:productName(/:urlID)" handler={SomeHandler} />...
Andrew Rasmussen's user avatar
2 votes
1 answer
3k views

//ArticlePage const ArticlePage = ({ match }) => { const name = match.params.name; return ( <> <h1> This is {name} Article </h1> </&...
Arya Singh's user avatar
5 votes
2 answers
1k views

I am a little confused on how to do (multiple) optional path parameters from the root. I'm using react-router 3, and redux 4.3. From what I understand, (/:param1)(/:param2) should work, but I am ...
its30's user avatar
  • 273
0 votes
1 answer
1k views

<Route path='/change-password/?resetToken=(:token)' component={()=><h1>testing</h1>} /> Above route don't render when I hit the url below? http://localhost:3000/change-password/?...
Jenny Mok's user avatar
  • 2,804
1 vote
1 answer
836 views

Need help with pagination. Right now my app can change page, but if I want send request like /character?page=4 it always throw me /character?page=1 this is not help, coz I use router. I have no idea ...
Max Fillsen's user avatar
0 votes
1 answer
628 views

This Stack Overflow question/answer explains how to define React Router (v4) routes which contain multiple optional parameter, eg.: <Route path="/to/page/:pathParam1?/:pathParam2?" component={...
machineghost's user avatar
0 votes
1 answer
435 views

I have this simple enough React app (created with create-react-app 1.5.2, and fluff removed). It has by default installed react-router 4.2.0. // index.js import React from 'react'; import ReactDOM ...
sampathsris's user avatar
  • 22.4k
0 votes
2 answers
576 views

I am trying to make optional sub routes with my React Router but no matter what I search I can't seem to find a solution that works for me ! I tried every solution mentioned in this answer: React ...
hlynurl's user avatar
  • 17

15 30 50 per page