You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-72Lines changed: 26 additions & 72 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Create React apps with no build configuration.
4
4
5
-
*[Getting Started](#getting-started) – How to create a new app.
5
+
*[Creating an App](#creating-an-app) – How to create a new app.
6
6
*[User Guide](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App.
7
7
8
8
Create React App works on macOS, Windows, and Linux.<br>
@@ -28,23 +28,17 @@ They are preconfigured and hidden so that you can focus on the code.
28
28
29
29
Just create a project, and you’re good to go.
30
30
31
-
## Getting Started
31
+
## Creating an App
32
32
33
-
### Prerequisites
34
-
35
-
**You’ll need to have Node >= 6 on your machine**. 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.
36
-
37
-
**This tool doesn’t assume a Node backend**. The Node installation is only required for Create React App itself.
38
-
39
-
### Creating an App
33
+
**For the build tools, you’ll need to have Node >= 6 on your machine**. 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. Note that Create React App **works with any backend** because it produces static HTML/JS/CSS bundles.
40
34
41
35
To create a new app, run a single command:
42
36
43
37
```sh
44
38
npx create-react-app my-app
45
39
```
46
40
47
-
([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))
41
+
*([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))*
48
42
49
43
It will create a directory called `my-app` inside the current folder.<br>
50
44
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
@@ -161,59 +155,48 @@ Please refer to the [User Guide](https://github.com/facebookincubator/create-rea
161
155
162
156
***No Lock-In:** You can “eject” to a custom setup at any time. Run a single command, and all the configuration and build dependencies will be moved directly into your project, so you can pick up right where you left off.
163
157
164
-
## Why Use This?
158
+
## What’s Included?
165
159
166
-
**If you’re getting started** with React, use `create-react-app` to automate the build of your app. There is no configuration file, and `react-scripts` is the only extra build dependency in your `package.json`. Your environment will have everything you need to build a modern React app:
160
+
Your environment will have everything you need to build a modern single-page React app:
167
161
168
162
* React, JSX, ES6, and Flow syntax support.
169
163
* Language extras beyond ES6 like the object spread operator.
170
-
* A dev server that lints for common errors.
171
-
* Import CSS and image files directly from JavaScript.
172
164
* Autoprefixed CSS, so you don’t need `-webkit` or other prefixes.
173
-
* A `build` script to bundle JS, CSS, and images for production, with sourcemaps.
165
+
* A fast interactive unit test runner with built-in support for coverage reporting.
166
+
* A live development server that warns about common mistakes.
167
+
* A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps.
174
168
* An offline-first [service worker](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers) and a [web app manifest](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/), meeting all the [Progressive Web App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app) criteria.
169
+
* Hassle-free updates for the above tools with a single dependency.
175
170
176
-
**The feature set is intentionally limited**. It doesn’t support advanced features such as server rendering or CSS modules. The tool is also **non-configurable** because it is hard to provide a cohesive experience and easy updates across a set of tools when the user can tweak anything.
177
-
178
-
**You don’t have to use this.** Historically it has been easy to [gradually adopt](https://www.youtube.com/watch?v=BF58ZJ1ZQxY) React. However many people create new single-page React apps from scratch every day. We’ve heard [loud](https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4) and [clear](https://twitter.com/thomasfuchs/status/708675139253174273) that this process can be error-prone and tedious, especially if this is your first JavaScript build stack. This project is an attempt to figure out a good way to start developing React apps.
179
-
180
-
### Converting to a Custom Setup
171
+
Check out [this guide](https://github.com/nitishdayal/cra_closer_look) for an overview of how these tools fit together.
181
172
182
-
**If you’re a power user** and you aren’t happy with the default configuration, you can “eject” from the tool and use it as a boilerplate generator.
173
+
The tradeoff is that **these tools are preconfigured to work in a specific way**. If your project needs more customization, you can ["eject"](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-eject) and customize it, but then you will need to maintain this configuration.
183
174
184
-
Running `npm run eject` copies all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. Commands like `npm start` and `npm run build` will still work, but they will point to the copied scripts so you can tweak them. At this point, you’re on your own.
175
+
## Popular Alternatives
185
176
186
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
177
+
This project is a great fit for:
187
178
188
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
179
+
* Learning React in a comfortable and feature-rich development environment.
180
+
* Starting new single-page React applications.
181
+
* Creating examples with React for your library.
189
182
190
-
## Limitations
183
+
Here’s a few common cases where you might want to try something else:
191
184
192
-
Some features are currently **not supported**:
185
+
* If you want to **try React** without installing hundreds of `node_modules`, consider [using a single HTML file or an online sandbox instead](https://reactjs.org/docs/try-react.html).
193
186
194
-
* Server rendering.
195
-
* Some experimental syntax extensions (e.g. decorators).
196
-
* CSS Modules (see [#2285](https://github.com/facebookincubator/create-react-app/pull/2285)).
197
-
* Importing LESS or Sass directly ([but you still can use them](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-a-css-preprocessor-sass-less-etc)).
198
-
* Hot reloading of components.
187
+
* Maybe you are **not building a single-page application** and need to integrate your React code with an existing template-based server framework such as Rails or Django. In this case, consider using projects like [nwb](https://github.com/insin/nwb) or [Neutrino](https://neutrino.js.org/) which are more flexible.
199
188
200
-
Some of them might get added in the future if they are stable, are useful to majority of React apps, don’t conflict with existing tools, and don’t introduce additional configuration.
189
+
* If you need to **publish a React component**, [nwb](https://github.com/insin/nwb) can [also do this](https://github.com/insin/nwb#react-components-and-libraries).
201
190
202
-
## What’s Inside?
191
+
* If you want to do **server rendering** with React, check out [Next.js](https://github.com/zeit/next.js/) or [Razzle](https://github.com/jaredpalmer/razzle). Create React App is agnostic of the backend, and just produces static HTML/JS/CSS bundles.
203
192
204
-
The tools used by Create React App are subject to change.
205
-
Currently it is a thin layer on top of many amazing community projects, such as:
193
+
* If your website is **mostly static** (for example, a portfolio or a blog), consider using [Gatsby](https://www.gatsbyjs.org/) instead. Unlike Create React App, it pre-renders the website into HTML at the build time.
206
194
207
-
*[webpack](https://webpack.js.org/) with [webpack-dev-server](https://github.com/webpack/webpack-dev-server), [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin) and [style-loader](https://github.com/webpack/style-loader)
208
-
*[Babel](http://babeljs.io/) with ES6 and extensions used by Facebook (JSX, [object spread](https://github.com/sebmarkbage/ecmascript-rest-spread/commits/master), [class properties](https://github.com/jeffmo/es-class-public-fields))
* Finally, if you need **more customization**, check out [Neutrino](https://neutrino.js.org/) and its [React preset](https://neutrino.js.org/packages/react/).
213
196
214
-
All of them are transitive dependencies of the provided npm package.
197
+
All of the above tools can work with little to no configuration.
215
198
216
-
Check out [this guide](https://github.com/nitishdayal/cra_closer_look) for an overview of how these tools fit together.
199
+
If you prefer configuring the build yourself, [follow this guide](https://reactjs.org/docs/add-react-to-an-existing-app.html).
217
200
218
201
## Contributing
219
202
@@ -231,32 +214,3 @@ We are grateful to the authors of existing related projects for their ideas and
231
214
*[@eanplatter](https://github.com/eanplatter)
232
215
*[@insin](https://github.com/insin)
233
216
*[@mxstbr](https://github.com/mxstbr)
234
-
235
-
## Alternatives
236
-
237
-
If you don’t agree with the choices made in this project, you might want to explore alternatives with different tradeoffs.<br>
238
-
Some of the more popular and actively maintained ones are:
0 commit comments