Search⌘ K

Using Context Variables

Explore how to implement context variables for state management by modifying landing page views and menus. Learn to replace prop passing with React’s useContext hook to access login functionality directly, streamlining component communication and preparing for more advanced state handling later in the course.

About the application

In this application, we’ll look at some modifications on our landing page view and menu. Our application will not have to pass isLoggedIn and logout as props. Using useContext() hook function, we can get the actual values from the component, which in our case is a dictionary containing the login functionality.

This is what the application looks like:

Note: ...