First, create a new project. Open a terminal, then run the following command:

npx create-react-app tutorial-03-component
Once this is finished, change into the project directory:

cd tutorial-03-component
tutorial-03-component/src/App.js

import React from 'react';
import './App.css';

const displayEmojiName = event => alert(event.target.id);
const emojis = [
  {
    emoji: '😀',
    name: "test grinning face"
  },
  {
    emoji: '🎉',
    name: "party popper"
  },
  {
    emoji: '💃',
    name: "woman dancing"
  }
];

function App() {
  const greeting = "greeting";
  const displayAction = false;
  return(
    <div className="container">
      <h1 id={greeting}>Hello, World</h1>
      {displayAction && <p>I am writing JSX</p>}
      <ul>
        {
          emojis.map(emoji => (
            <li key={emoji.name}>
              <button
                onClick={displayEmojiName}
              >
                <span role="img" aria-label={emoji.name} id={emoji.name}>{emoji.emoji}</span>
              </button>
            </li>
          ))
        }
      </ul>
    </div>
  )
}

export default App;
Open another terminal window in the root of your project. Start the project with the following command:

npm start
Open the App.js code in a text editor:

nano src/App.js
Save and close the file. You can now delete the logo.svg file, since it was part of the template and you are not referencing it anymore:

rm src/logo.svg
tutorial-03-component/src/App.css

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

button {
    font-size: 2em;
    border: 0;
    padding: 0;
    background: none;
    cursor: pointer;
}

ul {
    display: flex;
    padding: 0;
}

li {
    margin: 0 20px;
    list-style: none;
    padding: 0;
}
Now, update the styling. Open src/App.css:

nano src/App.css

Recommend

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Conclusion Want to learn more? Join the DigitalOcean Community! Still looking for an answer?

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Testing Fail2Ban Policies

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Getting Info About Enabled Jails

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Implementing your Apache Jails

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Adjusting the General Settings within Fail2Ban Changing Defaults

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Adjusting the General Settings within Fail2Ban

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Install Fail2Ban

How To Protect an Apache Server with Fail2Ban on Ubuntu 14.04 Installing Apache and Configuring Password Authentication

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 Step 4: Test PHP Processing on your Web Server

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 Step 3: Install PHP Install PHP Modules

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 Step 3: Install PHP

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 Step 2: Install MySQL

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 Step 1: Install Apache How To Find your Server’s Public IP Address

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 Step 1: Install Apache

Ubuntu 20.04へのDocker Composeのインストールおよび使用方法 ステップ4 — Docker Composeコマンドに精通する

Ubuntu 20.04へのDocker Composeのインストールおよび使用方法 ステップ3 — Docker Composeを実行する

Ubuntu 20.04へのDocker Composeのインストールおよび使用方法 ステップ2 —docker-compose.ymlファイルをセットアップする

Ubuntu 20.04へのDocker Composeのインストールおよび使用方法 ステップ1— Docker Composeをインストールする

How To Set Up a Private Docker Registry on Ubuntu 14.04 Conclusion Want to learn more? Join the DigitalOcean Community! Still looking for an answer?

How To Set Up a Private Docker Registry on Ubuntu 14.04 Step 11 — Pull from Your Docker Registry

How To Set Up a Private Docker Registry on Ubuntu 14.04 Step 10 — Publish to Your Private Docker Registry

How To Set Up a Private Docker Registry on Ubuntu 14.04 Step 9 — Accessing Your Docker Registry from a Client Machine

How To Set Up a Private Docker Registry on Ubuntu 14.04 Step 8 — Starting Docker Registry as a Service

How To Set Up a Private Docker Registry on Ubuntu 14.04 Step 7 — Setting SSL Port to 443

How To Set Up a Private Docker Registry on Ubuntu 14.04 Step 6 — Testing SSL