DEV Community

Akash
Akash

Posted on

useContext and useNavigate

=>USECONTEXT

  • It is a React Hook used to share data between components without passing props manually at every level.
  • Used to solve Props Drilling

=> USENAVIGATE

  • useNavigate is a React Router hook that lets you navigate between pages using JavaScript code.

1.Login Scenario

OUTPUT:

2.Logout Scenario


OUTPUT:

3.Namesharing Scenario


OUTPUT:

4.ButtonNavigation Scenario


OUTPUT:

5.Back Navigation Scenario

OUTPUT:

Top comments (0)