DEV Community

loading...

How Does Create React App Work?

reliableanswersonly profile image Reliable Answers Only ・1 min read

Create React App is a standalone tool that can be run using either npm or Yarn.

You can generate and run a new project using npm just with a couple of commands:

npx create-react-app new-app
cd new-app
npm start
Enter fullscreen mode Exit fullscreen mode

If you prefer Yarn, you can do it like this:

yarn create react-app new-app
cd new app
yarn start
Enter fullscreen mode Exit fullscreen mode

Create React App will set up the following project structure:

new-app
├── .gitignore
├── node_modules
├── package.json
├── public
│   ├── favicon.ico
│   ├── index.html
│   ├── logo192.png
│   ├── logo512.png
│   ├── manifest.json
│   └── robots.txt
├── README.md
├── src
│   ├── App.css
│   ├── App.js
│   ├── App.test.js
│   ├── index.css
│   ├── index.js
│   ├── logo.svg
│   ├── reportWebVitals.js
│   └── setupTests.js
└── yarn.lock
Enter fullscreen mode Exit fullscreen mode

It will also add a react-scripts package to your project that will contain all of the configurations and build scripts. In other words, your project depends on react-scripts, not on create-react-app itself. Once the installation is complete, you can fire up the dev server and start working on your project.

Read Full Article from SitePoint.

Discussion (0)

pic
Editor guide