project_google_clone
project_google_clone copied to clipboard
Router problem
Compiled with problems:X
ERROR in ./src/components/Routes.jsx 10:33-39
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, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams)
Compiled with problems:X
ERROR in ./src/components/Routes.jsx 10:33-39
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, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams)
try use Routes as Switch
Instead of Switch import {Routes,Route,Navigation} from 'react-router-dom'; <Routes> Route exact path="/" element={<Navigate replace to="/search"/>}/> </ Routes>
React Router Dom has been updated with its latest version. Use Routes instead of Switch import {BrowseRouter, Routes, Route} from {react-router-dom}; <BrowseRouter> <Routes> <Route path="/" element= {component_name} /> <Routes> </BrowseRouter>