react-router icon indicating copy to clipboard operation
react-router copied to clipboard

[Bug]: react-router-dom-v5-compat not importing react-router-dom v5 in tests (DX)

Open Streeterxs opened this issue 3 years ago • 2 comments

What version of React Router are you using?

v5-compat

Steps to Reproduce

Import a Switch from "react-router-dom":

import { Switch } from "react-router-dom";

...
    console.log({Switch});
    act(() => {
      ReactDOM.render(
        <MemoryRouter initialEntries={["/home"]}>
          <CompatRouter>
            <Switch>
              <CompatRoute path="home" element={<Home />} />
              <CompatRoute path="/details" element={<Details />} />
            </Switch>
          </CompatRouter>
        </MemoryRouter>,
        node
      );

image

Expected Behavior

After yarn install and yarn build (as CONTRIBUTING.md says) should install react-router-dom from packages/react-router-dom-v5-compat/package.json peerDependencies to permit usage and testability of CompatRoute and CompatRouter

Actual Behavior

Breaking my CompatRoute fail test on Switch usage (and CompatRouter useHistory() as well).

Streeterxs avatar Apr 06 '22 14:04 Streeterxs

@Streeterxs Did you find a workaround for this?

rtlong avatar Aug 16 '22 18:08 rtlong

This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed.

github-actions[bot] avatar Apr 24 '23 22:04 github-actions[bot]