ScanSkill

How to Get Started with React

In this example, we will see how to get started with react. We will be creating a simple Hello React App using React. Before we get started, make sure you have the node installed on your system.

Example

Step 1: Create React App

npx create-react-app app-name

This syntax will set up everything we need for the react app.

Step 2: Run the App

Run the App

cd app-name
npm start

The cd app-name will take us to the project directory and npm start runs that react app.

The project will start on localhost:3000 and will look like this:

How to Get Started with React

Step 3: Edit App.js

let's edit App.js to print a simple "Hello React" text.

import './App.css';

function App() {
  return (
    <div className="App">
      <h1>Hello React </h1>
    </div>
  );
}

export default App;

Output

How to Get Started with React

Conclusion

In this example, we learned how to get started with react. We created a simple Hello React App using React.