Skip to content

[Bug]: No longer allowed to nest MemoryRouter inside Router #9109

@dw-bayer

Description

@dw-bayer

What version of React Router are you using?

6

Steps to Reproduce

<Router>
    // all sorts of normal app stuff
    // ...
    // ... deep in a nested component
    <Popup>
        <MemoryRouter initialEntries={[match.url]}>
            <ComponentWithRoutesThatIsAlsoUsedWithNormalRouer />
        </MemoryRouter>
    </Popup>
</Router>

Expected Behavior

We needed a way to take a component that exists in our normal routes with history.back() and redirects and gingerly place it into a dialog popup WITHOUT having any of the routing paths show up in the browsers url and without our in-app back buttons sending the user away from the dialog and still getting to navigate deeper into the component. Wrapping the MemoryRouter around the component nested inside the main Router worked without a hitch. Gave us a little Router sandbox.

Actual Behavior

Now, in v6, we're barred from doing that. :(
Can this be a warning instead of an error?
Is there something else we could/should be doing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions