Lab Activity: Add React Components with NPM
Lab Activity: Add React Components with NPM
Lab Activity: Add React Components with NPM
In this lab activity, we’ll be making a drawer that sends a coupon code to the customer’s email using Material UI’s React framework.
Objectives
Prerequisites
Stencil’s architecture allows for organized customization using npm and React. In production, you can use these tools for stylizing seasonally themed products, temporary promotions, or event tickets. Below is a short tutorial on using npm and React to customize your Stencil theme.
The resulting customization will look like the following:

You should have most of the following already setup. Use the steps to verify as you go through this activity.
To build this customization, complete the instructions in the following sections.
For this activity, we’ll be using packages from MUI Core. These components require certain modules.
Navigate into the root Cornerstone theme folder, then install the following npm packages.
Update webpack.common.js with the new presets and plugins.
In the following steps, we’ll be adding React components to assemble our coupon drawer.
Note: This coupon drawer example does not send coupon codes to the emails entered. This is only an example to show how to customize your storefront theme.