Error while using useNavigate hook with react router
Hello guys,I am building a project while learning context api in react js.
I have put all my variables and functions in AppContext.jsx, so they can be accessed and manipulated by component according to the need.
But in some part of AppContext.jsx , I have used useNavigate hook (which must be used under Router, according to docs) is giving error that "useNavigate() may be used only in the context of a <Router> component ".
I don't know how to solve this error, please help me out in this.


1 Reply
optimistic-goldOP•21h ago
Appcontext.jsx code
