> For the complete documentation index, see [llms.txt](https://edrus.gitbook.io/mt-it/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edrus.gitbook.io/mt-it/2nd-month/week-6/react-js/getting-started.md).

# Getting Started

### Creating an App[​](https://create-react-app.dev/docs/getting-started/#creating-an-app) <a href="#creating-an-app" id="creating-an-app"></a>

**You’ll need to have Node >= 14 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 switch Node versions between different projects.

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

#### npx[​](https://create-react-app.dev/docs/getting-started/#npx) <a href="#npx" id="npx"></a>

```
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[​](https://create-react-app.dev/docs/getting-started/#npm) <a href="#npm" id="npm"></a>

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

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

#### Yarn[​](https://create-react-app.dev/docs/getting-started/#yarn) <a href="#yarn" id="yarn"></a>

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

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

#### Selecting a package manager[​](https://create-react-app.dev/docs/getting-started/#selecting-a-package-manager) <a href="#selecting-a-package-manager" id="selecting-a-package-manager"></a>

When you create a new app, the CLI will use [npm](https://docs.npmjs.com/) or [Yarn](https://yarnpkg.com/) to install dependencies, depending on which tool you use to run `create-react-app`. For example:

```
# Run this to use npm
npx create-react-app my-app
# Or run this to use yarn
yarn create react-app my-app
```

### Output[​](https://create-react-app.dev/docs/getting-started/#output) <a href="#output" id="output"></a>

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
│   ├── logo192.png
│   ├── logo512.png
│   ├── manifest.json
│   └── robots.txt
└── src
    ├── App.css
    ├── App.js
    ├── App.test.js
    ├── index.css
    ├── index.js
    ├── logo.svg
    ├── serviceWorker.js
    └── setupTests.js
```

Copy

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

```
cd my-app
```

### Scripts[​](https://create-react-app.dev/docs/getting-started/#scripts) <a href="#scripts" id="scripts"></a>

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

#### `npm start` or `yarn start`[​](https://create-react-app.dev/docs/getting-started/#npm-start-or-yarn-start) <a href="#npm-start-or-yarn-start" id="npm-start-or-yarn-start"></a>

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.

<img src="https://cdn.jsdelivr.net/gh/marionebl/create-react-app@9f6282671c54f0874afd37a72f6689727b562498/screencast-error.svg" alt="Build errors" width="600">

#### `npm test` or `yarn test`[​](https://create-react-app.dev/docs/getting-started/#npm-test-or-yarn-test) <a href="#npm-test-or-yarn-test" id="npm-test-or-yarn-test"></a>

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://create-react-app.dev/docs/running-tests).

#### `npm run build` or `yarn build`[​](https://create-react-app.dev/docs/getting-started/#npm-run-build-or-yarn-build) <a href="#npm-run-build-or-yarn-build" id="npm-run-build-or-yarn-build"></a>

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.

<br>
