Using backwards compatibility library with dependency which uses react-router-dom v5 #8898
Unanswered
neilredford-sky
asked this question in
v5 to v6 Migration
Replies: 1 comment
-
I guess your webpack config cause this issue. Because we hope import You may need to add the relative path before the absolute path in resolve.modules of webpack config. https://webpack.js.org/configuration/resolve/#resolvemodules |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a dependency which uses react-router-dom v5.1.2 and I am unable to upgrade this.
I'm using react-router-dom-v5-compat v6.3.0 in the parent app and I have completely migrated the app over to using react router v6 components and hooks.
When I load the component containing the above dependency I see the following error
react-router.js:706 Uncaught TypeError: Cannot read properties of undefined (reading 'history') at useHistory (react-router.js:706:29)
I thought adding CompatRouter below my BrowserRouter would fix this but when I do this I see a different error and the app fails to load entirely
scheduler.development.js:178 Uncaught TypeError: Cannot read properties of undefined (reading 'history') at useHistory (react-router.js:706:29) at CompatRouter (index.js:386:17)
Any help on this would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions