Project: The Plan
Northwind shop.
Time to build a real app. A shop for Northwind Bikes. Customers can browse products, search, open a product page, fill a cart, and check out.
- A real app
- Northwind Bikes
- Browse to checkout
The component tree
App sets up the cart and the routes. A layout draws the header on every page. Inside it, a page appears. The product list, a product page, the cart, or checkout.
The files
The api file stands in for the server. The cart reducer and cart context manage the cart. Product list and product card show products. The cart panel and checkout handle buying. And App ties it all together.
| File | Job |
|---|---|
| api.js | pretend server |
| cartReducer.js | cart logic |
| CartContext.jsx | share the cart |
| ProductList.jsx | browse and search |
| CartPanel.jsx | what's inside |
| Checkout.jsx | place the order |
Using what we learned
State and reducers for the cart. Context to share it. Effects to load data. Custom hooks, routing, forms, and validation. Almost everything from this course appears.
| key | value |
|---|---|
| Cart | useReducer + context |
| Data | effects |
| Pages | React Router |
| Checkout | forms, validation |
Summary
We have a plan, a tree, and a list of files. Next, the product data.
Key takeaways- Components
- Files
- Plan