I have a code like this :
<BrowserRouter>
<Switch>
<Route path="/" exact component={component1} />
<Route path="/somewhere/:something" component={component2} />
</Switch>
</BrowserRouter>
I tried this, because in the end, I want to match several paths with the same component / result :
<BrowserRouter>
<Switch>
<Route path={["/somewhere/:something","/somewhere2/:something"]} component={component2} />
</Switch>
</BrowserRouter>
and the path is matched, but my parameter (:something) isnt passed to it. Any idea why ? react-router's docs tells me :
Any valid URL path or array of paths that path-to-regexp@^1.7.0 understands.
The feature was only recently added to React-Router. You need to upgrade your react-router installation to be able to match the documentation and use the feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With