Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR in ./src/Login.js export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom' #56

Open
emmanuelkorir opened this issue Aug 24, 2022 · 5 comments

Comments

@emmanuelkorir
Copy link

ERROR in ./src/Login.js 15:18-28

export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom' (possible exports: BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, createSearchParams, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, unstable_HistoryRouter, useHref, useInRouterContext, useLinkClickHandler, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams)

ERROR in ./src/Login.js 131:10-20

export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom' (possible exports: BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, createSearchParams, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, unstable_HistoryRouter, useHref, useInRouterContext, useLinkClickHandler, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams)

@bagewadi-akram
Copy link

use react router dom v5.3.3.

@Naveen-singla
Copy link

@emmanuelkorir a more simple way is to use usenavigate() instead of useHistory()

@Triamb-Talwar
Copy link

useHistory got depreciated.
use this instead:-
import { useNavigate } from 'react-router-dom';
const navigate = useNavigate();

@antarah
Copy link

antarah commented Mar 19, 2023

const navigate = useNavigate();
and then replace history.push('/path') with navigate('/path')

@Eiche-S
Copy link

Eiche-S commented Apr 25, 2023

useHistory got depreciated. use this instead:- import { useNavigate } from 'react-router-dom'; const navigate = useNavigate();

works like a charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants