react-router icon indicating copy to clipboard operation
react-router copied to clipboard

[Bug]: v3 incompatibility with React 18 and StrictMode

Open maisano-patreon opened this issue 11 months ago • 1 comments

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.

maisano-patreon avatar Mar 26 '24 15:03 maisano-patreon

I think I am having this problem. Please see my question at:

https://stackoverflow.com/questions/78258527/react-router-not-routing/78258651#78258651

jcabrerazuniga avatar Apr 02 '24 20:04 jcabrerazuniga

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.

zmras avatar May 07 '24 15:05 zmras

v3 is no longer supported. It hasn't been substantially worked on in nearly a decade.

timdorr avatar May 08 '24 15:05 timdorr