-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Break out Installation into top-level doc section #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gaearon
merged 21 commits into
reactjs:master
from
alexkrolick:top-level-installation-guide
Dec 23, 2017
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
bee089a
Break out Installation into top-level doc section
alexkrolick e87ec4f
Update navigation (prev/next, nav tree)
alexkrolick 451ca08
add links to other install options from try react page
alexkrolick fa8d576
fix markdown link
alexkrolick 2365e37
Clarify that Quick Start and Install are optional "next steps"
alexkrolick 289bd7e
Add top-level CDN page
alexkrolick 4ed0bad
Add link to Tutorial from Try React
alexkrolick 2c65291
Update CRA link in tutorial
alexkrolick 6ab880a
Make Try React subheader a proper sentence
alexkrolick a3fd8b4
Add "minimal"
alexkrolick 32299c4
Explain local dev setup is more work than Codepen etc
alexkrolick 29382bb
Fix typos
alexkrolick 1df722c
Add : between headings
alexkrolick b9e6eab
add note that CRA is not lightweight
alexkrolick c76df53
fix typo
alexkrolick b7159cf
Update add-react-to-a-new-app.md
gaearon 9975cfa
Update add-react-to-a-new-app.md
gaearon e1c2df4
Remove the Bower note
gaearon 9ce4233
Update try-react.md
gaearon e332245
Tweak wording
gaearon bcf3a5b
Use direct link
gaearon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| --- | ||
| id: add-react-to-a-new-app | ||
| title: Add React to a New Application | ||
| permalink: docs/add-react-to-a-new-app.html | ||
| prev: try-react.html | ||
| next: add-react-to-an-existing-app.html | ||
| --- | ||
|
|
||
| The easiest way to get started on a new React project is by using a starter kit. | ||
|
|
||
| > Note: | ||
| > | ||
| > Check out the [Try React](/docs/try-react.html) page if you are looking for lightweight environments to experiment with React. | ||
| > The options on this page are designed to help bootstrap single-page applications with linting, testing, bundling, production optimizations, and more. | ||
|
|
||
| ## Create React App | ||
|
|
||
| [Create React App](http://github.com/facebookincubator/create-react-app) is the best way to start building a new React single page application. It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production. You’ll need to have Node >= 6 on your machine. | ||
|
|
||
| ```bash | ||
| npm install -g create-react-app | ||
| create-react-app my-app | ||
|
|
||
| cd my-app | ||
| npm start | ||
| ``` | ||
|
|
||
| If you have npm 5.2.0+ installed, you may use [npx](https://www.npmjs.com/package/npx) instead. | ||
|
|
||
| ```bash | ||
| npx create-react-app my-app | ||
|
|
||
| cd my-app | ||
| npm start | ||
| ``` | ||
|
|
||
| Create React App doesn't handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want. It uses build tools like [Babel](http://babeljs.io/) and [webpack](https://webpack.js.org/) under the hood, but works with zero configuration. | ||
|
|
||
| When you're ready to deploy to production, running `npm run build` will create an optimized build of your app in the `build` folder. You can learn more about Create React App [from its README](https://github.com/facebookincubator/create-react-app#create-react-app-) and the [User Guide](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#table-of-contents). | ||
|
|
||
| ## Other Starter Kits | ||
|
|
||
| See the Community section for a list of [starter kits](/community/starter-kits.html). | ||
|
|
||
| ## Advanced | ||
|
|
||
| If you prefer to configure a project manually, see [Installing React](/docs/add-react-to-an-existing-app.html#installing-react) in the next section. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| id: cdn-links | ||
| title: CDN Links | ||
| permalink: docs/cdn-links.html | ||
| prev: add-react-to-an-existing-app.html | ||
| next: hello-world.html | ||
| --- | ||
|
|
||
| The UMD builds of React and ReactDOM are available over a CDN. | ||
|
|
||
| ```html | ||
| <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> | ||
| <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | ||
| ``` | ||
|
|
||
| The versions above are only meant for development, and are not suitable for production. Minified and optimized production versions of React are available at: | ||
|
|
||
| ```html | ||
| <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> | ||
| <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> | ||
| ``` | ||
|
|
||
| To load a specific version of `react` and `react-dom`, replace `16` with the version number. | ||
|
|
||
| ### Why the `crossorigin` Attribute? | ||
|
|
||
| If you serve React from a CDN, we recommend to keep the [`crossorigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) attribute set: | ||
|
|
||
| ```html | ||
| <script crossorigin src="..."></script> | ||
| ``` | ||
|
|
||
| We also recommend to verify that the CDN you are using sets the `Access-Control-Allow-Origin: *` HTTP header: | ||
|
|
||
|  | ||
|
|
||
| This enables a better [error handling experience](/blog/2017/07/26/error-handling-in-react-16.html) in React 16 and later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| id: try-react | ||
| title: Try React | ||
| permalink: docs/try-react.html | ||
| next: add-react-to-a-new-app.html | ||
| redirect_from: | ||
| - "docs/installation.html" | ||
| - "download.html" | ||
| - "downloads.html" | ||
| - "docs/tooling-integration.html" | ||
| - "docs/package-management.html" | ||
| - "docs/language-tooling.html" | ||
| - "docs/environments.html" | ||
| --- | ||
|
|
||
| Try React online or set up your local development environment. | ||
|
|
||
| ## Online | ||
|
|
||
| If you're just interested in playing around with React, you can use an online code playground. Try a Hello World template on [CodePen](codepen://hello-world) or [CodeSandbox](https://codesandbox.io/s/new). | ||
|
|
||
| ## Minimal HTML Template | ||
|
|
||
| If you prefer to use your own text editor, you can also [download this HTML file](https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html), edit it, and open it from the local filesystem in your browser. It does a slow runtime code transformation, so don't use it in production. | ||
|
|
||
| ## Next Steps | ||
|
|
||
| ### Quick Start | ||
|
|
||
| - Head over to the [Quick Start](/docs/hello-world.html) section for a step-by-step introduction to React concepts. | ||
|
|
||
| - Try the [Tutorial](/tutorial/tutorial.html) for a hands-on practical example. | ||
|
|
||
| ### Complete Development Environment | ||
|
|
||
| The lightweight solutions above are the best fit if you are new to React or just experimenting. | ||
|
|
||
| When you are ready to build your first application with React, check out the install guides below. These setups are designed to get you up and running with a great developer experience and are ready for production. They include linting, testing, and optimizations built-in; however, they require more time and disk space to set up and install. | ||
|
|
||
| - [Add React to a New App](/docs/add-react-to-a-new-app.html): Create a new app with a fully-featured starter kit. | ||
| - [Add React to an Existing App](/docs/add-react-to-a-new-app.html): Add React to a build system or a larger app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to https://github.com/reactjs/reactjs.org/pull/452/files#r158572397: maybe it's worth pointing people looking for something lightweight to "Try React" from this page. I'd love if we could make it clearer that this is a fully-featured setup that isn't required for using React but covers common needs for a single-page application including linting, testing, optimizations, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Added a note here