DEV Community

Cover image for What is UseNavigate and Browser Router in react?
Narasimma Radhakrishnan
Narasimma Radhakrishnan

Posted on

What is UseNavigate and Browser Router in react?

In React, BrowserRouter and useNavigate are used for navigation between pages without refreshing the entire website.

Let's understand with your Movie Explorer project.

  1. What is BrowserRouter? BrowserRouter is used to enable routing in a React application.

It allows us to create multiple pages such as:

  • Home page
  • Cart page
  • Billing page
  1. What is useNavigate? useNavigate is a React Router Hook used to navigate from one page to another programmatically.

For example, when the user clicks the View Cart button, we want to open the Cart page.

Top comments (0)