This video is available to students only
Create a Context Hook to Handle CheckoutItems
Bring the Context API into Hardware Handler to decrease our reliance on props.
This page is a preview of The newline Guide to Modernizing an Enterprise React App
- The Context API can eliminate our need to pass props to child components for checkout
- App.js passes a lot of checkout state throughout the site
- First, set up a context folder
- Make a new CheckoutItemContext.js file
- Add CheckoutItemContext to the <App>
- Import the context
- Wrap App's JSX with the context provider
- Delete checkoutCount from being passed to <Navbar>
- Refactor Navbar.js to use the useContext Hook
Contents