Importing useNavigate hook
To import the useHistory hook, write the following code at the top of the component
import { useNavigate } from "react-router-dom"
Replacement of useHistory hook in React
In this article, we will learn how to replace the useHistory hook in React. With the introduction of new versions of React Hooks, useNavigate in React replaced the useHistory hook. useNavigate hook is a React hook that allows you to navigate your application imperatively.
Table of Content
- What is useHistory hook?
- What is useNavigate hook?
- Why useHistory hook was deprecated?
- Importing useNavigate hook
- Structure of useNavigate hook
Contact Us