Creating a Basic React App
To create a basic React app, we can use the create-react-app
command-line tool. This tool sets up a new React project with a basic project structure and some default configurations.
To create a new React app, follow these steps:
- Open your terminal or command prompt.
- Run the following command to install
create-react-app
globally, if you haven't already:
SNIPPET
1npm install -g create-react-app
- Navigate to the directory where you want to create your new app.
- Run the following command to create a new React app:
SNIPPET
1npx create-react-app my-app
This will create a new directory called my-app
with the basic React project structure and dependencies.
- Change into the new app directory:
SNIPPET
1cd my-app
- Start the development server:
SNIPPET
1npm start
This will start the development server and open your app in a web browser. You can now start coding your React app!
Remember, the create-react-app
tool provides a lot of convenient features out of the box, such as hot module reloading, optimized production build, and more. Feel free to explore the generated project structure and configuration files to learn more about how to customize your React app.
xxxxxxxxxx
// Install create-react-app globally
code: `npx create-react-app my-app`
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment