Creating an App with Create React App
npx create-react-app app-name
cd app-name
npm start
What Create React App Sets Up
Create React App (CRA) is a command that generates a ready-to-run React project -- folder structure, a build configuration, and a dev server -- so you don't have to configure a bundler by hand.
Example: What Create React App Sets Up
$ npx create-react-app my-app
Creating: my-app/src, my-app/public, my-app/package.json
Success! Your project is ready.
⚠️ Run this in your own terminal or Node.js environment.
Starting the Dev Server
Inside a CRA project, running npm start launches a local development server (usually at localhost:3000) that automatically reloads the page whenever you save a file.
Example: Starting the Dev Server
$ npm start
Compiled successfully!
Local: http://localhost:3000
⚠️ Run this in your own terminal or Node.js environment.
The CRA Folder Structure
A fresh CRA project has a src/ folder for your components (starting with App.js and index.js), a public/ folder for static files like the HTML shell and favicon, and package.json listing dependencies.
Example: The CRA Folder Structure
$ ls -R my-app
my-app:
node_modules package.json public README.md src
my-app/public:
favicon.ico index.html manifest.json robots.txt
my-app/src:
App.css App.js App.test.js index.css index.js logo.svg
⚠️ Run this in your own terminal or Node.js environment.
- Using Create React App for new projects even though it's no longer actively recommended in favor of Vite.
- Not understanding what
npm startandnpm run buildactually do under the hood. - Manually editing generated config files without realizing they may be reset on updates.
- Create React App (CRA) scaffolds a complete React project with one command.
- It bundles Webpack, Babel, and other tooling so you don't configure them yourself.
npm startruns a local dev server;npm run buildcreates a production bundle.- CRA is now considered legacy -- Vite is the more commonly recommended alternative today.
The generated app itself supports all modern evergreen browsers by default; CRA is a build tool, not a runtime concern.
Chapter Quiz — Complete all 10 topics to unlock
0/10 topics done
Complete these topics first: