<Router> Context error #8857
              
                Unanswered
              
          
                  
                    
                      Kartik-Mohan
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    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 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