Skip to content

Commit cf3fcd6

Browse files
authored
Merge branch 'master' into add-docs-for-multiple-select
2 parents ed03a35 + 4a11063 commit cf3fcd6

File tree

245 files changed

+11182
-6588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+11182
-6588
lines changed

.babelrc

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
11
{
2-
"presets": ['react', 'es2015', 'stage-1'],
3-
"plugins": ['add-module-exports']
4-
}
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"loose": true,
7+
"modules": false,
8+
"useBuiltIns": "usage",
9+
"shippedProposals": true,
10+
"targets": {
11+
"browsers": [">0.25%", "not dead"],
12+
}
13+
}
14+
],
15+
[
16+
"@babel/preset-react",
17+
{
18+
"useBuiltIns": true,
19+
"pragma": "React.createElement",
20+
}
21+
],
22+
"@babel/flow"
23+
],
24+
"plugins": [
25+
[
26+
"@babel/plugin-proposal-class-properties",
27+
{
28+
"loose": true
29+
}
30+
],
31+
"@babel/plugin-syntax-dynamic-import",
32+
"babel-plugin-macros",
33+
[
34+
"@babel/plugin-transform-runtime",
35+
{
36+
"helpers": true,
37+
"regenerator": true
38+
}
39+
]
40+
]
41+
}

.circleci/config.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/node:latest
5+
- image: circleci/node:8
66
steps:
77
- checkout
88
- restore_cache:
99
keys:
10-
- dependencies-{{ checksum "package.json" }}
11-
# fallback to using the latest cache if no exact match is found
12-
- dependencies-
10+
- dependencies-{{ checksum "yarn.lock" }}
1311
- run:
1412
name: Install
15-
command: yarn install
13+
command: yarn install --pure-lockfile
1614
- save_cache:
1715
paths:
1816
- node_modules
19-
key: dependencies-{{ checksum "package.json" }}
17+
key: dependencies-{{ checksum "yarn.lock" }}
2018
- run:
2119
name: Check Prettier, ESLint, Flow
2220
command: yarn ci-check

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
2+
3+
<!--
4+
15
Thank you for the PR! Contributors like you keep React awesome!
26
37
Please see the Contribution Guide for guidelines:
48
59
https://github.com/reactjs/reactjs.org/blob/master/CONTRIBUTING.md
610
7-
If your PR references an existing issue, please add the issue number below:
11+
If your PR references an existing issue, please add the issue number below
812
9-
#<Issue>
13+
-->

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.idea
44
node_modules
55
public
6+
yarn-error.log

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.4
1+
lts/carbon

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ so that you can understand what actions will and will not be tolerated.
1414

1515
The documentation is divided into sections to cater to different learning styles and use cases. When editing an article, try to match the surrounding text in tone and style. When creating a new article, try to match the tone of the other articles in the same section. Learn about the motivation behind each section below.
1616

17+
**[Installation](https://reactjs.org/docs/getting-started.html)** gives an overview of the docs, and demonstrates two different ways to use it: either as a simple `<script>` tag on the page, or as part of a complex JavaScript toolchain.
18+
1719
**[Tutorial](https://reactjs.org/tutorial/tutorial.html)** is relatively informal, and is designed for people who prefer a hands-on approach to learning, and can tolerate skipping theory in favor of practice. Its goal is to give the reader a feel for a typical React workflow rather than to explain fundamentals in detail. Here we focus on *what* to do and spend less time on *how* or *why* we did it. It is extremely important to do a lot of hand-holding and unambiguously describe every single change. It should be possible for a beginner to mechanically follow every instruction, and still get to a working tic-tac-toe game.
1820

19-
**[Quick Start](https://reactjs.org/docs/hello-world.html)** is designed to introduce fundamental concepts in a step-by-step way. Each individual article in Quick Start builds on the knowledge from the previous ones, so make sure not to add any "cyclical dependencies" between them. It is important that the reader can start with the first article and work their way to the last Quick Start article without ever having to "look ahead" for a definition. This explains some ordering choices (e.g. that state is explained before events, or that "thinking in React" doesn't use refs). Quick Start also serves as a reference manual for React concepts, so it is important to be very strict about their definitions and relationships between them. This is, for example, why we introduce elements before components. Resist adding too much detail to Quick Start articles. They intentionally don't cover all corner cases, and focus on establishing firm foundations.
21+
**[Main Concepts](https://reactjs.org/docs/hello-world.html)** is designed to introduce fundamental concepts in a step-by-step way. Each individual article in Main Concepts builds on the knowledge from the previous ones, so make sure not to add any "cyclical dependencies" between them. It is important that the reader can start with the first article and work their way to the last Main Concepts article without ever having to "look ahead" for a definition. This explains some ordering choices (e.g. that state is explained before events, or that "thinking in React" doesn't use refs). Main Concepts also serves as a reference manual for React concepts, so it is important to be very strict about their definitions and relationships between them. This is, for example, why we introduce elements before components. Resist adding too much detail to Main Concepts articles. They intentionally don't cover all corner cases, and focus on establishing firm foundations.
2022

2123
**[Advanced Guides](https://reactjs.org/docs/jsx-in-depth.html)** are deep dives into topics that aren't essential for a beginner developer but that everyone bumps into sooner or later. They don't have a specific order, and target more experienced developers. If you have a set of recipes fitting a particular use case, and those recipes aren't opinionated (most React users would agree on them), this is the place to add them.
2224

23-
**[Reference](https://reactjs.org/docs/react-api.html)** is organized by APIs rather than concepts. It is intended to be exhaustive. Any corner cases or recommendations that were skipped for brevity in Quick Start or Advanced Guides should be mentioned in the reference documentation for the corresponding APIs.
25+
**[Reference](https://reactjs.org/docs/react-api.html)** is organized by APIs rather than concepts. It is intended to be exhaustive. Any corner cases or recommendations that were skipped for brevity in Main Concepts or Advanced Guides should be mentioned in the reference documentation for the corresponding APIs.
2426

2527
**[Contributing](https://reactjs.org/docs/how-to-contribute.html)** should stay up-to-date and be friendly to relatively experienced developers.
2628

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ This repo contains the source code and documentation powering [reactjs.org](http
77
### Prerequisites
88

99
1. Git
10-
1. Node: install version 8.4 or greater
10+
1. Node: any 8.x version starting with 8.4.0 or greater
1111
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
12-
1. A clone of the [reactjs.org repo](https://github.com/reactjs/reactjs.org) on your local machine
1312
1. A fork of the repo (for any contributions)
13+
1. A clone of the [reactjs.org repo](https://github.com/reactjs/reactjs.org) on your local machine
1414

1515
### Installation
1616

@@ -24,6 +24,10 @@ This repo contains the source code and documentation powering [reactjs.org](http
2424

2525
## Contributing
2626

27+
### Guidelines
28+
29+
The documentation is divided into several sections with a different tone and purpose. If you plan to write more than a few sentences, you might find it helpful to get familiar with the [contributing guidelines](https://github.com/reactjs/reactjs.org/blob/master/CONTRIBUTING.md#guidelines-for-text) for the appropriate sections.
30+
2731
### Create a branch
2832

2933
1. `git checkout master` from any folder in your local `reactjs.org` repository
@@ -51,6 +55,12 @@ This repo contains the source code and documentation powering [reactjs.org](http
5155
1. Follow GitHub's instructions.
5256
1. If possible, include screenshots of visual changes. A Netlify build will also be automatically created once you make your PR so other people can see your change.
5357

58+
## Translation
59+
60+
If you are interesting in translating `reactjs.org`, please join the Crowdin.
61+
62+
* [Crowdin - React](https://crowdin.com/project/react)
63+
5464
## Troubleshooting
5565

5666
- `yarn reset` to clear the local cache

content/authors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ sebmarkbage:
6969
url: https://twitter.com/sebmarkbage
7070
sophiebits:
7171
name: Sophie Alpert
72-
url: https://sophiealpert.com
72+
url: https://sophiebits.com/
7373
steveluscher:
7474
name: Steven Luscher
7575
url: https://twitter.com/steveluscher

content/blog/2013-06-05-why-react.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ some pretty cool things with it:
8080
(including IE8) and automatically use
8181
[event delegation](http://davidwalsh.name/event-delegate).
8282

83-
Head on over to https://reactjs.org to check out what we have
83+
Head on over to [https://reactjs.org](https://reactjs.org) to check out what we have
8484
built. Our documentation is geared towards building apps with the framework,
8585
but if you are interested in the nuts and bolts
8686
[get in touch](/support.html) with us!

content/blog/2014-10-14-introducing-react-elements.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: "Introducing React Elements"
33
author: [sebmarkbage]
4-
redirect_from: "blog/2014/10/14/introducting-react-elements.html"
4+
redirect_from:
5+
- "blog/2014/10/14/introducting-react-elements.html"
56
---
67

78
The upcoming React 0.12 tweaks some APIs to get us close to the final 1.0 API. This release is all about setting us up for making the `ReactElement` type really FAST, [jest unit testing](https://facebook.github.io/jest/) easier, making classes simpler (in preparation for ES6 classes) and better integration with third-party languages!

content/blog/2015-12-16-ismounted-antipattern.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ If you use ES6 promises, you may need to wrap your promise in order to make it c
4343

4444
```js
4545
const cancelablePromise = makeCancelable(
46-
new Promise(r => component.setState({...}}))
46+
new Promise(r => component.setState({...}))
4747
);
4848

4949
cancelablePromise

content/blog/2016-07-11-introducing-reacts-error-code-system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ In order to make debugging in production easier, we're introducing an Error Code
1313

1414
While we hope you don't see errors often, you can see how it works [here](/docs/error-decoder.html?invariant=109&args[]=Foo). This is what the same error from above will look like:
1515

16-
> Minified React error #109; visit https://reactjs.org/docs/error-decoder.html?invariant=109&args[]=Foo for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
16+
> Minified React error #109; visit [https://reactjs.org/docs/error-decoder.html?invariant=109&args[]=Foo](/docs/error-decoder.html?invariant=109&args[]=Foo) for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
1717
1818
We do this so that the developer experience is as good as possible, while also keeping the production bundle size as small as possible. This feature shouldn't require any changes on your side — use the `min.js` files in production or bundle your application code with `process.env.NODE_ENV === 'production'` and you should be good to go!

content/blog/2017-09-25-react-v15.6.2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ In case you don't use a bundler, we also provide pre-built bundles in the npm pa
3434
Minified build for production: [react/dist/react.min.js](https://unpkg.com/react@15.6.2/dist/react.min.js)<br/>
3535
* **React with Add-Ons**<br/>
3636
Dev build with warnings: [react/dist/react-with-addons.js](https://unpkg.com/react@15.6.2/dist/react-with-addons.js)<br/>
37-
Minified build for production: [react/dist/react-with-addons.min.js](https://unpkg.com/react@15.5.0/dist/react-with-addons.min.js)<br/>
37+
Minified build for production: [react/dist/react-with-addons.min.js](https://unpkg.com/react@15.6.2/dist/react-with-addons.min.js)<br/>
3838
* **React DOM** (include React in the page before React DOM)<br/>
3939
Dev build with warnings: [react-dom/dist/react-dom.js](https://unpkg.com/react-dom@15.6.2/dist/react-dom.js)<br/>
4040
Minified build for production: [react-dom/dist/react-dom.min.js](https://unpkg.com/react-dom@15.6.2/dist/react-dom.min.js)<br/>

content/blog/2017-11-28-react-v16.2.0-fragment-support.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ render() {
5050
}
5151
```
5252

53-
To address this limitation, React 16.0 added support for [returning an array of elements from a component's `render` method](https://reactjs.org/blog/2017/09/26/react-v16.0.html#new-render-return-types-fragments-and-strings). Instead of wrapping the children in a DOM element, you can put them into an array:
53+
To address this limitation, React 16.0 added support for [returning an array of elements from a component's `render` method](/blog/2017/09/26/react-v16.0.html#new-render-return-types-fragments-and-strings). Instead of wrapping the children in a DOM element, you can put them into an array:
5454

5555
```jsx
5656
render() {
@@ -67,7 +67,7 @@ render() {
6767
However, this has some confusing differences from normal JSX:
6868

6969
- Children in an array must be separated by commas.
70-
- Children in an array must have a key to prevent React's [key warning](https://reactjs.org/docs/lists-and-keys.html#keys).
70+
- Children in an array must have a key to prevent React's [key warning](/docs/lists-and-keys.html#keys).
7171
- Strings must be wrapped in quotes.
7272

7373
To provide a more consistent authoring experience for fragments, React now provides a first-class `Fragment` component that can be used in place of arrays.
@@ -225,7 +225,7 @@ to update Flow to the latest version.
225225

226226
### Prettier
227227

228-
[Prettier](https://github.com/prettier/prettier) will have support for fragments in their upcoming [1.9 release](https://github.com/prettier/prettier/pull/3237).
228+
[Prettier](https://github.com/prettier/prettier) added support for fragments in their [1.9 release](https://prettier.io/blog/2017/12/05/1.9.0.html#jsx-fragment-syntax-3237-https-githubcom-prettier-prettier-pull-3237-by-duailibe-https-githubcom-duailibe).
229229

230230
### ESLint
231231

@@ -263,7 +263,7 @@ It may take a while for fragment syntax to be supported in your text editor. Ple
263263

264264
#### TypeScript Editor Support
265265

266-
If you're a TypeScript user -- great news! Editor support for JSX fragments is already available in [Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48593), [Visual Studio 2017](https://www.microsoft.com/en-us/download/details.aspx?id=55258), and [Sublime Text via Package Control](https://packagecontrol.io/packages/TypeScript). Visual Studio Code will be updated soon, but [can be configured to use TypeScript 2.6.2 and later](https://code.visualstudio.com/Docs/languages/typescript#_using-newer-typescript-versions).
266+
If you're a TypeScript user -- great news! Editor support for JSX fragments is already available in [Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48593), [Visual Studio 2017](https://www.microsoft.com/en-us/download/details.aspx?id=55258), [Visual Studio Code](https://code.visualstudio.com/updates/v1_19#_jsx-fragment-syntax) and [Sublime Text via Package Control](https://packagecontrol.io/packages/TypeScript).
267267

268268
### Other Tools
269269

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Sneak Peek: Beyond React 16"
3+
author: [sophiebits]
4+
---
5+
6+
[Dan Abramov](https://twitter.com/dan_abramov) from our team just spoke at [JSConf Iceland 2018](https://2018.jsconf.is/) with a preview of some new features we've been working on in React. The talk opens with a question: "With vast differences in computing power and network speed, how do we deliver the best user experience for everyone?"
7+
8+
Here's the video courtesy of JSConf Iceland:
9+
10+
<br>
11+
12+
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/nLF0n9SACd4?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
13+
14+
I think you'll enjoy the talk more if you stop reading here and just watch the video. If you don't have time to watch, a (very) brief summary follows.
15+
16+
## About the Two Demos
17+
18+
On the first demo, Dan says: "We've built a generic way to ensure that high-priority updates don't get blocked by a low-priority update, called **time slicing**. If my device is fast enough, it feels almost like it's synchronous; if my device is slow, the app still feels responsive. It adapts to the device thanks to the [requestIdleCallback](https://developers.google.com/web/updates/2015/08/using-requestidlecallback) API. Notice that only the final state was displayed; the rendered screen is always consistent and we don't see visual artifacts of slow rendering causing a janky user experience."
19+
20+
On the second demo, Dan explains: "We've built a generic way for components to suspend rendering while they load async data, which we call **suspense**. You can pause any state update until the data is ready, and you can add async loading to any component deep in the tree without plumbing all the props and state through your app and hoisting the logic. On a fast network, updates appear very fluid and instantaneous without a jarring cascade of spinners that appear and disappear. On a slow network, you can intentionally design which loading states the user should see and how granular or coarse they should be, instead of showing spinners based on how the code is written. The app stays responsive throughout."
21+
22+
"Importantly, this is still the React you know. This is still the declarative component paradigm that you probably like about React."
23+
24+
We can't wait to release these new async rendering features later this year. Follow this blog and [@reactjs on Twitter](https://twitter.com/reactjs) for updates.

0 commit comments

Comments
 (0)