Answer the question
In order to leave comments, you need to log in
Why is there no Switch export in 'React-router-dom' folder?
I installed the react routing package, when importing it in a component, it says that Switch is not exported, and indeed, there is no such export in the file in the 'React-router-dom' folder. Tried reinstalling - to no avail. And it's not in the 'react-router' folder either, nowhere...
Compiled with problems:X
WARNING in ./src/components/App.js 15:49-55
export 'Switch' (imported as 'Switch') was not found in 'react-router-dom' (possible exports: BrowserRouter, HashRouter , Link, MemoryRouter, NavLink, Navigate, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createRoutesFromChildren, createSearchParams, generatePath, matchPath, matchRoutes, renderMatches, resolvePath, unstable_HistoryRouter, useHref, useInRouterContext, useLinkClickHandler, useLocation, useNavigate , useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams)
Answer the question
In order to leave comments, you need to log in
In the new, 6th version, something has changed!
replace with
Read the documentation.
PS In Google it was possible to score like that
import { Switch, Route } from "react-router-dom";
import { Routes ,Route } from 'react-router-dom';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question