- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Building a Grocery List App with React
React is one of the most popular front-end web development frameworks in the world and something worth knowing a little about. It provides a declarative and composable interface to make building user interfaces with complex interactions more manageable. In this hands-on lab, we'll go through building a simple grocery shopping list application from start to finish. To feel comfortable completing this lab, you'll need to know how to do the following: - Create a new React application. - Utilize state and props within React components. - Handle browser events using React components. If you're currently unsure of how to perform any of these actions, consider taking the short **Expanding Your JS Skills with React** course to get up to speed.

Lab Info
Table of Contents
-
Challenge
Create the Groceries React Application
Generate a new React application called
groceries
so that we can build the grocery shopping list application.Optional: Add Bulma for Styling
In order to follow along with the styling used in the example solution for this hands-on lab, you'll need bulma.
public/index.html
<!DOCTYPE html> <html lang="en"> <head> <!-- rest of head omitted --> <title>React App</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" /> <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" ></script> </head> <!-- body omitted --> </html>
-
Challenge
Display a New Item Form and the Grocery Items
The goal of this application is to act as a checklist of groceries that need to be purchased including the grocery item names and the quantity of each. To begin, we'll want to modify our
App
component to display a form that allows us to add a new grocery item and display the items already on our list. -
Challenge
Add the Ability to Add a New Grocery Item
Write the necessary event handling function(s) to allow someone to submit the new grocery item form and have the information added to the application's state. It should also be displayed to the screen.
-
Challenge
Add the Ability to Check Off a Grocery Item
Modify the application so that the user can click the checkbox of a grocery item and have it toggle the
purchased
state of the grocery item in the application's state.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.