Home > other >  Can I have compatibility issues with react and react-dom if I upgrade react-router-dom?
Can I have compatibility issues with react and react-dom if I upgrade react-router-dom?

Time:12-01

I created a web app and I've been learning react as I go. I created a react app with create react app command, and I've been working with these versions of react,react-dom and react-router-dom.

"react": "17.0.2",
"react-dom": "17.0.2",
"react-router-dom": "^5.3.4", 

These last two were installed automatically, and I don't really understand how these interact, or if they do, even.

I want to upgrade react-router-dom from v5.3.4 to v6, but I don't know if by upgrading react-router-dom I will have compatibility issues with the other dependencies.

Are these dependencies compatible with each other?

As a bonus question, is there a place where I can see compatibility between different packages? I usually find this information by accident while reading StackOverflow answers to related questions in StackOverflow.

Thanks!

CodePudding user response:

I want to upgrade react-router-dom from v5.3.4 to v6, but I don't know if by upgrading react-router-dom I will have compatibility issues with the other dependencies.

Are these dependencies compatible with each other?

The only (recent) issue I'm aware of between react/react-dom and react-router-dom is between react@18 and react-router-dom versions below v5.3.3 and the app was being rendered into a React.StrictMode component. You can read a bit more about this in my answer here: Link tag inside BrowserRouter changes only the URL but doesn't render the component. The problem is resolved in [email protected] and higher.

If you are sticking to react@17 there are no issues with react-router-dom, they work seamlessly without issue. If also upgrading to react@18 and using [email protected] or higher (i.e. v6) there are also no issues.

Is there a place where I can see compatibility between different packages?

Nothing I'm aware of, no. I think most issues are found organically and may be filed as issues in the various repos hosting the specific packages. If you find an issue with a library/package, then that repo's issues tracker/section is likely where you want to start a search (other than Googling the issue, which may lead to stackoverflow posts or the repo issues directly).

  • Related