React-router: Route string[] paths with params

Created on 4 Dec 2018  路  3Comments  路  Source: ReactTraining/react-router

Version

4.3.1

Test Case

https://codesandbox.io/s/jjmlnxzky

Steps to reproduce

Click on Test 1, notice no id after id:
Click on Test 2 notice id: test2

Expected Behavior

The id param to be populated no matter which path matched.

Actual Behavior

The params in the second path only come through (or are replacing the first)

Most helpful comment

No worries, there was actually just another issue (#6500) about the docs site being different than the current release. The site used to be really outdated, but now it is automatically updated when new PRs are merged onto the master branch. Something should probably be done to make sure that the docs aren't giving incorrect information.

All 3 comments

This is not possible with v4.3. Support for path arrays was added in #5889, which you can test in the v4.4 beta releases (npm i react-router-dom@next).

Ah, cool. I was just referencing the docs: https://reacttraining.com/react-router/web/api/Route/path-string-string

Sorry for the noise.

No worries, there was actually just another issue (#6500) about the docs site being different than the current release. The site used to be really outdated, but now it is automatically updated when new PRs are merged onto the master branch. Something should probably be done to make sure that the docs aren't giving incorrect information.

Was this page helpful?
0 / 5 - 0 ratings