DEV Community

Pawan Saini
Pawan Saini

Posted on

How to create a React project from scratch in 5 Minutes

Here's a quick tutorial on how to create a React project from scratch:

Install Node.js and npm: https://nodejs.org/en/
Create a new directory for your project: mkdir my-project
Go into the project directory: cd my-project
Initialize a new npm project: npm init -y
Install React and ReactDOM: npm install react react-dom
Create an index.js file in your project directory: touch index.js
Open the index.js file in a text editor and add the following code:
javascript
Copy code
import React from 'react';
import ReactDOM from 'react-dom';

const App = () => {

return (



Hello React!





);

};

ReactDOM.render(, document.getElementById('root'));

Create an index.html file in your project directory: touch index.html

Open the index.html file in a text editor and add the following code:

php

Copy code

<!DOCTYPE html>





My React App













Run the app in your browser by opening the index.html file.

Congratulations! You just created your first React app.

Top comments (0)