Skip to content

Attempted import error: 'Switch' is not exported from 'react-router-dom' #130

Open
@sayinmehmet47

Description

@sayinmehmet47

After downloding , "react-router-dom": "^6.0.0-beta.8", Switch is not available anymore. So my this code fire error.

import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { AnimatedSwitch } from "react-router-transition";

import routes from "./routes";

const RouterProvider = () => (
  <BrowserRouter>
    <Routes>
      <AnimatedSwitch
        atEnter={{ opacity: 0 }}
        atLeave={{ opacity: 0 }}
        atActive={{ opacity: 1 }}
        className="switch-wrapper"
      >
        {routes.map((route) => (
          <Route key={route.path} path={route.path} element={route.component} />
        ))}
      </AnimatedSwitch>
    </Routes>
  </BrowserRouter>
);

export default RouterProvider;

My error is **./node_modules/react-router-transition/lib/index.js
Attempted import error: 'Switch' is not exported from 'react-router-dom'.
**
is there any way to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions