This video is available to students only
- The newline Guide to Modernizing an Enterprise React App
- Create Custom Hooks for the App
The useCheckout Hook will do Double Duty in our App
Some custom hooks can help simplify code beyond the original components they touch.
This page is a preview of The newline Guide to Modernizing an Enterprise React App
- Refactor two checkout API calls into one in useCheckout Hook
- The checkout API is a popular service
- Target the useEffect in <Checkout> first
- Create a new useCheckout.js custom hook file
- Declare checkoutItems and error states in the hook
- Move the useEffect into useCheckout.js
- Import useCheckout.js into the Checkout component
- Retest App Functionality
Contents