"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Getting started with react

Getting started with react

Published on 2024-11-04
Browse:175

Getting started with react

Firstly, React is a popular JavaScript library for building UI, especially for single-page applications. It allows developers to create reusable components and efficiently manage the state of their applications. In this blog, I'll go through the process of setting up a React project and many more.

Prerequisites
Before getting into the react or creating react project, you must have to install the following tools.

1. Node.js: you can download the latest version of Node.js from the official website: https://nodejs.org/en.
2. Code Editor: You can use any editor that your comfortable with, I highly recommended to use VSCode.

How to create a project

  1. Open command prompt or your terminal.
  2. Run the following cmd
//Replace my-app with the name of your project.
npx create-react-app my-app

//navigate to your project directory
cd my-app 

//this cmd helps us to run our script
npm start 

Folder Structure

my-app/
├── node_modules/
├── public/
│   ├── index.html
│   └── manifest.json
├── src/
│   ├── components/
│   ├── App.css
│   ├── App.js
│   ├── App.test.js
│   ├── index.css
│   ├── index.js
│   └── reportWebVitals.js
├── .gitignore
├── package-lock.json
├── package.json
└── README.md

1. node_modules: A directory where all the dependencies like libraries and packages required by your project are stored.

2. src: The source folder that contains all your React application code. This is where you write the components, styles, and logic for your React application.

3. package.json: A JSON file that contains metadata about your project and the dependencies it requires. It manages the project's dependencies, scripts, version, and other things.

Release Statement This article is reproduced at: https://dev.to/poornima545/getting-started-with-react-2599?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3