0

I have three applications, Container, App1, and App2, all of them React applications. Container is a container application and App1 and App2 are applications embedded within Container. The Container application initializes its routes in the typical ReactRouter 6 way with createBrowserRouter and RouterProvider, but I would like to share this router with App1 and App2. In ReactRouter 5, I was able to pass the history object and then had the opportunity to create a Router component with the history object passed from the "Container" application.

My question is, how can I do the same thing in ReactRouter 6 since history is no longer available?

I have used useInRouterContext() to make sure the router context was not "magically" passed. And I have checked the Router signature in the docs but I must admit it didn't help.

There is a similar question How to pass history to App Insights with React Router 6 but it is focused in the history object and I am looking for solutions which not include the history object.

Richie
  • 161
  • 3

0 Answers0