You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a mono-repo(which is managed by rush library) in Github which has two main folders - One is (apps) and another one is (libs).
Apps folder usually consist of UI elements which is presentation layer, I am using webpack for bundling apps. Libs folder usually consist of all necessary components which apps will use, I am using rollup for building libs. Once libs are bundled we are using libs as dependency in package.json of (apps).
Here the problem is, I am using react-router-dom in libs folder, which is not accessible outside of libs once bundled. I want to incorporate router functionality in apps folder but I am getting an error which shows below,
"Uncaught Error: useNavigate() may be used only in the context of a component."
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have created a mono-repo(which is managed by rush library) in Github which has two main folders - One is (apps) and another one is (libs).
Apps folder usually consist of UI elements which is presentation layer, I am using webpack for bundling apps.
Libs folder usually consist of all necessary components which apps will use, I am using rollup for building libs.
Once libs are bundled we are using libs as dependency in package.json of (apps).
Here the problem is, I am using react-router-dom in libs folder, which is not accessible outside of libs once bundled. I want to incorporate router functionality in apps folder but I am getting an error which shows below,
"Uncaught Error: useNavigate() may be used only in the context of a component."
Project folder structure:

Beta Was this translation helpful? Give feedback.
All reactions