SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Build Luigi App with React

Create a mock shopping application with React and configure it using Luigi.

Overview

🎓 beginner 25 min. User InterfaceBeginnerJavascript

You will learn

  • How to add content to your React web shopping app
  • How to use Luigi to configure navigation
  • How to create simple micro-frontends using React
Johannes Doberer J Johannes Doberer August 21, 2026
Created on December 10, 2024
Contributors

More from Johannes Doberer

See all 7 tutorials by Johannes Doberer →

Prerequisites

Steps

Step 1 Add a file with product data

In this step, you will create a file with information about the products on sale in your shopping app.

In a real life implementation, this data would be provided by an external service/API. But for simplicity, you will create a .js file containing dummy data. This file will provide the displayed data in the micro-frontend. You will create a similar file in the UI5 micro-frontend to avoid bundling issues.

  1. Navigate to react-core-mf/src/assets and create a products.js file with the following content:

    JavaScript
    export const ProductCollection = [
    {
        "id": 101,
        "name": "Mouse",
        "price": 45.0,
        "stock": 80,
        "icon": "product",
        "currencyCode": "EUR",
        "orderQuantity": 2,
        "description": "Wireless Gaming Mouse with Sensor"
    },
    {
        "id": 102,
        "name": "Keyboard",
        "price": 50.0,
        "stock": 22,
        "icon": "product",
        "currencyCode": "EUR",
        "orderQuantity": 1,
        "description": "A physical keyboard that uses an individual spring and switch for each key. Today, only premium keyboards are built with key switches."
    },
    {
        "id": 103,
        "name": "Optical Mouse",
        "price": 35.0,
        "stock": 4,
        "icon": "product",
        "currencyCode": "EUR",
        "orderQuantity": 2,
        "description": "Utilizing the latest optical sensing technology, the USB Optical Scroll Mouse records precise motion."
    },
    {
        "id": 104,
        "name": "Laptop Pro",
        "price": 1299.0,
        "stock": 11,
        "icon": "laptop",
        "currencyCode": "EUR",
        "orderQuantity": 3,
        "description": "Newest laptop featuring a touch-sensitive OLED display."
    },
    {
        "id": 105,
        "name": "Mouse 2",
        "price": 40.0,
        "stock": 20,
        "icon": "product",
        "currencyCode": "EUR",
        "orderQuantity": 6,
        "description": "The Mouse 2 is a computer mouse featuring a multi-touch acrylic surface for scrolling. The mouse features a lithium-ion rechargeable battery and Lightning connector for charging and pairing."
    },
    {
        "id": 106,
        "name": "Printer",
        "price": 235.0,
        "stock": 24,
        "icon": "fx",
        "currencyCode": "EUR",
        "orderQuantity": 1,
        "description": "Affordable printer providing you with the optimal way to take care of all your printing needs."
    },
    {
        "id": 107,
        "name": "Phone 11",
        "price": 835.0,
        "stock": 45,
        "icon": "iphone",
        "currencyCode": "EUR",
        "orderQuantity": 8,
        "description": "The Phone 11 dimensions are 150.9mm x 75.7mm x 8.3mm (H x W x D). It weighs about 194 grams (6.84 ounces)."
    },
    {
        "id": 108,
        "name": "Phone 3a",
        "price": 299.0,
        "stock": 54,
        "icon": "desktop-mobile",
        "currencyCode": "EUR",
        "orderQuantity": 7,
        "description": "At 5.6 inches, the display is proportionate to the relatively small body of the phone."
    },
    {
        "id": 109,
        "name": "Game Console 4",
        "price": 330.0,
        "stock": 94,
        "icon": "video",
        "currencyCode": "EUR",
        "orderQuantity": 1,
        "description": "This is the fourth home video game console compatible with all gaming systems."
    },
    {
        "id": 110,
        "name": "Monitor",
        "price": 630.0,
        "stock": 20,
        "icon": "sys-monitor",
        "currencyCode": "EUR",
        "orderQuantity": 3,
        "description": "34'' Monitor, Display with stand Height adjustable (115 mm), tiltable (-5° to 21°), rotatable (-30° to 30°) Security slot (cable lock sold separately), anti-theft slot for locking to stand (for display). Includes: DisplayPort cable, HDMI cable, Power cable, Stand, USB 3.0 Type-A to Type-B cable, USB-C cable."
    }

];

Code

</div><div class="step-validation-mount"
      data-step="1"></div>
 <div class="step-actions">
   <button class="fd-button fd-button--emphasized" data-action="mark-done" data-step="1">Done</button>
 </div>
</div>
</div>






<div id="step-2" class="tutorial-step" data-step="2">
<div class="step-header" data-action="toggle-step">
 <span class="step-check-circle"></span>
 <div class="step-header-text">
   <span class="step-label">Step 2</span>
   <span class="step-title-text">Add Luigi to index.html</span>
 </div>
 <span class="step-toggle-icon">+</span>
</div>
<div class="step-body" hidden>
 <hr class="step-divider" />
 <div class="step-content">

In this step, you will let Luigi take control of the `index.html` file - the entry point for your app.

1. Go to `react-core-mf/public/index.html` and change its content to:

```HTML
<!DOCTYPE html>
<html>
  <head>
    <title>Luigi</title>
    <meta
      name="viewport"
      content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1"
    />
    <link rel="stylesheet" href="/luigi-core/luigi.css" />
  </head>

  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <script src="/luigi-core/luigi.js"></script>
    <script src="/luigi-config.js"></script>
  </body>
</html>
Step 3 Create micro-frontends template
+
Step 4 Configure webpack
+
Step 5 Configure Luigi for &quot;Home&quot; node
+
Step 6 Configure router for &quot;Home&quot; view
+
Step 7 Add &quot;Products&quot; view to Luigi app
+
Step 9 Install missing dependency
+
Step 10 Run your core app
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 10
1. Add a file with product data 2. Add Luigi to index.html 3. Create micro-frontends template 4. Configure webpack 5. Configure Luigi for "Home" node 6. Configure router for "Home" view 7. Add "Products" view to Luigi app 8. Add "Product Detail" view to Luigi app 9. Install missing dependency 10. Run your core app