I have a scenario where I need to call route() in my application from a component that is outside of <Router>. When I do this, the ROUTERS array in the internal preact-router code is empty. I'm, therefore, concluding that route() will only work if called from a component within <Router>.
In react-router, I believe this would be a situation where the component that calls route() (that lives outside of <Router>) could simply be wrapped in withRouter and it would work.
How can I get route() to work outside of <Router> without withRouter?
I have a scenario where I need to call
route()
in my application from a component that is outside of<Router>
. When I do this, theROUTERS
array in the internalpreact-router
code is empty. I'm, therefore, concluding thatroute()
will only work if called from a component within<Router>
.In
react-router
, I believe this would be a situation where the component that callsroute()
(that lives outside of<Router>
) could simply be wrapped inwithRouter
and it would work.How can I get
route()
to work outside of<Router>
withoutwithRouter
?