Uncaught Error: Make sure your app is wrapped in a <Router />
Uncaught Error: Make sure your app is wrapped in a <Router />
Several Stack Overflow answers said that you can't use useNavigate inside an event listener, which is what I was originally doing, so I tried to move it into a new component that is nested underneath <Router> but it seems like useNavigate only works on a component inside <Route>.
Is this intentional behavior, despite the error message looking for <Router>? Is there any other way to instantiate useNavigate at a high enough level that it will always trigger regardless of the current route?