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 you comfortable with, I highly recommended to use VSCode.
How to create a project
- Open command prompt or your terminal.
- 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.
Top comments (0)