https://github.com/ctrlplusb/react-router-match-issue
Strange issue when using react-router-addons-routes to do matching.
https://github.com/ctrlplusb/react-router-match-issue
Last synced: 10 months ago
JSON representation
Strange issue when using react-router-addons-routes to do matching.
- Host: GitHub
- URL: https://github.com/ctrlplusb/react-router-match-issue
- Owner: ctrlplusb
- Created: 2016-12-12T16:35:01.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-12T16:48:32.000Z (about 9 years ago)
- Last Synced: 2025-02-08T08:11:49.480Z (11 months ago)
- Language: JavaScript
- Size: 30.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## react-router-addons-routes bug report
https://github.com/ReactTraining/react-router-addons-routes/issues/15
```bash
yarn
npm run start
```
---
An example application is contained withing `src/index.js` which demonstrates a minimum routing configuration to recreate this issue.
Clicking on "Foo" or "Bar" should both result in resolved/rendered `Match` instances, however, as we are using `react-router-addons-routes/matchRoutesToLocation` to match against a custom set of routes before any of our `Match` components get hit something strange occurs and our "/foo/bar" `Match` component never gets rendered.
Look at the `CustomRouteMatcher` component in the src folder which is responsible for executing the custom route matching. If you clear the `customRoutes` array and then try browse to "/foo/bar" - you will notice all the expected `Match` components now get rendered.
Interestingly, if you append a "/" to the end of "/foo" in the `customRoutes` array you will notice that matching now works correctly and the `Bar` component is rendered.
I suspect there may be an issue with the way the internals of `react-router` caches routes/matches perhaps?
Or maybe there is behaviour baked into the route patterns that I am unaware of.
---
[LIVE EXAMPLE](https://react-router-match-debugging-wygetnppwf.now.sh)