> For the complete documentation index, see [llms.txt](https://tkssharma.gitbook.io/react-training/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tkssharma.gitbook.io/react-training/day-01/create-react-app-part-2.md).

# Create React App - Part-2

### Less to Learn

You don't need to learn and configure many build tools. Instant reloads help you focus on development. When it's time to deploy, your bundles are optimized automatically.

### Only One Dependency

Your app only needs one build dependency. We test Create React App to make sure that all of its underlying pieces work together seamlessly – no complicated version mismatches.

### No Lock-In

Under the hood, we use Webpack, Babel, ESLint, and other amazing projects to power your app. If you ever want an advanced configuration, you can ”eject” from Create React App and edit their config files directly.

### Get started in seconds

Whether you’re using React or another library, Create React App lets you **focus on code, not build tools**.

To create a project called `my-app`, run this command:

```
npx create-react-app my-app
```

![](https://facebook.github.io/create-react-app/img/update.png)

### Easy to maintain

Updating your build tooling is typically a daunting and time-consuming task. When new versions of Create React App are released, you can upgrade using a single command:

```
npm install react-scripts@latest
```

### Quick Start

```
npx create-react-app my-app
cd my-app
npm start
```

> If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that `npx` always uses the latest version.

*(*[*npx*](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) *comes with npm 5.2+ and higher, see* [*instructions for older npm versions*](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f)*)*

Then open <http://localhost:3000/> to see your app.

When you’re ready to deploy to production, create a minified bundle with `npm run build`.

![npm start](https://cdn.rawgit.com/facebook/create-react-app/27b42ac/screencast.svg)

#### Get Started Immediately

You **don’t** need to install or configure tools like Webpack or Babel. They are preconfigured and hidden so that you can focus on the code.

Just create a project, and you’re good to go.

### Creating an App

**You’ll need to have Node >= 8.10 on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to easily switch Node versions between different projects.

To create a new app, you may choose one of the following methods:

#### npx

```
npx create-react-app my-app
```

*(*[*npx*](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) *comes with npm 5.2+ and higher, see* [*instructions for older npm versions*](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f)*)*

#### npm

```
npm init react-app my-app
```

*`npm init <initializer>` is available in npm 6+*

#### Yarn

```
yarn create react-app my-app
```

*`yarn create` is available in Yarn 0.25+*

#### Creating a TypeScript app

Follow our [Adding TypeScript](https://facebook.github.io/create-react-app/docs/adding-typescript) documentation to create a TypeScript app.

### Output

Running any of these commands will create a directory called `my-app` inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies:

```
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
└── src
    ├── App.css
    ├── App.js
    ├── App.test.js
    ├── index.css
    ├── index.js
    ├── logo.svg
    └── serviceWorker.js
```

No configuration or complicated folder structures, just the files you need to build your app. Once the installation is done, you can open your project folder:

```
cd my-app
```

### Scripts

Inside the newly created project, you can run some built-in commands:

#### `npm start` or `yarn start`

Runs the app in development mode. Open [http://localhost:3000](http://localhost:3000/) to view it in the browser.

The page will automatically reload if you make changes to the code. You will see the build errors and lint warnings in the console.

![Build errors](https://cdn.rawgit.com/marionebl/create-react-app/9f62826/screencast-error.svg)

#### `npm test` or `yarn test`

Runs the test watcher in an interactive mode. By default, runs tests related to files changed since the last commit.

[Read more about testing](https://facebook.github.io/create-react-app/docs/running-tests).

#### `npm run build` or `yarn build`

Builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed.
