supasate / connected-react-router

A Redux binding for React Router v4
MIT License
4.73k stars 592 forks source link

Upgrade peer dependencies to support React 18 #585

Open SubbaramiReddy-y opened 1 year ago

SubbaramiReddy-y commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch connected-react-router@6.9.3 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/connected-react-router/package.json b/node_modules/connected-react-router/package.json
index 2c5b11b..3d3b210 100644
--- a/node_modules/connected-react-router/package.json
+++ b/node_modules/connected-react-router/package.json
@@ -33,7 +33,7 @@
   },
   "peerDependencies": {
     "history": "^4.7.2",
-    "react": "^16.4.0 || ^17.0.0",
+    "react": "^16.4.0 || ^17.0.0 || ^18.2.0",
     "react-redux": "^6.0.0 || ^7.1.0",
     "react-router": "^4.3.1 || ^5.0.0",
     "redux": "^3.6.0 || ^4.0.0"

This issue body was partially generated by patch-package.

kostenko commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch connected-react-router@6.9.3 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/connected-react-router/package.json b/node_modules/connected-react-router/package.json
index 2c5b11b..3d3b210 100644
--- a/node_modules/connected-react-router/package.json
+++ b/node_modules/connected-react-router/package.json
@@ -33,7 +33,7 @@
   },
   "peerDependencies": {
     "history": "^4.7.2",
-    "react": "^16.4.0 || ^17.0.0",
+    "react": "^16.4.0 || ^17.0.0 || ^18.2.0",
     "react-redux": "^6.0.0 || ^7.1.0",
     "react-router": "^4.3.1 || ^5.0.0",
     "redux": "^3.6.0 || ^4.0.0"

This issue body was partially generated by patch-package.

if you're like me and never used patch-package, the command needs to override the default value in the exclude option β€” to include package.json, otherwise it won't see the patch

npx patch-package connected-react-router --exclude

and, more importantly, it didn't solve the issue β€” npm i still failed with

npm ERR! While resolving: connected-react-router@6.9.3
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"18.2.0" from the root project
npm ERR!   peer react@">=15" from react-router-dom@5.3.4