react-router
react-router copied to clipboard
[Bug]: v3 incompatibility with React 18 and StrictMode
What version of React Router are you using?
v3
Steps to Reproduce
<StrictMode>
<BrowserRouter>
<Route path="/a" component={A} />
<Route path="/b" component={B} />
</BrowserRouter>
</StrictMode>
Load /a
, navigate to /b
.
Expected Behavior
A
is initially rendered, then B
is later rendered post navigation.
Actual Behavior
A
is initially rendered, then there's no change post navigation.
There's no change due to the transition manager being bound in componentWillMount
rather than componentDidMount
.
I have a very small patch that resolves this and would allow me to migrate a large codebase heavily coupled to v3 to React 18 without dropping StrictMode
. Short of this, I'll likely locally publish an internal fork of v3 with 18 compat. I am well aware that I'm asking to patch a years-old version of this package, but I wanted to check before forking.
I think I am having this problem. Please see my question at:
https://stackoverflow.com/questions/78258527/react-router-not-routing/78258651#78258651
I'm also facing the same issue. And I can't really migrate to newer version because it's a big project using some unavailable features in the newer versions (like onEnter, onLeave). A patch of v3 with react 18 compatibility would be appreciated.
v3 is no longer supported. It hasn't been substantially worked on in nearly a decade.