Creating the Frontend

Let's learn how to set up the frontend of an application using React.

In this lesson, we’ll start building the frontend of our application.

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';


ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);
serviceWorker.unregister();
Importing the React DOM and React

Our application lives in the src folder. We’ll go here for all React components, CSS styles, images, and anything else our application needs. Any other files outside this folder are meant to support building our application (the src folder is where we’ll work 99% of the time). In the src folder, create the index.js file with the code given above. This file is the main entry point for our application. In the index.js file, we render the App React element into the root DOM node.

Note: Applications solely built with React usually have a single root DOM node.

Lines 1–3: In the index.js file, we import React and ReactDOM. These ...