Skip to content

Commit 03df4d4

Browse files
committed
Merge branch 'master' into feature/flow-types
2 parents 232d154 + 7d8abd8 commit 03df4d4

File tree

107 files changed

+5160
-2574
lines changed

Some content is hidden

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

107 files changed

+5160
-2574
lines changed

Diff for: .eslintignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ node_modules/*
44
content/*
55

66
# Ignore built files
7-
public/*
7+
public/*
8+
9+
# Ignore examples
10+
examples/*

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Thank you for the PR! Contributors like you keep React awesome!
2+
3+
Please see the Contribution Guide for guidelines:
4+
5+
https://github.com/reactjs/reactjs.org/blob/master/CONTRIBUTING.md

Diff for: CONTRIBUTING.md

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to the React Docs!
4+
5+
## Code of Conduct
6+
7+
Facebook has adopted a Code of Conduct that we expect project
8+
participants to adhere to. Please [read the full text](https://code.facebook.com/codeofconduct)
9+
so that you can understand what actions will and will not be tolerated.
10+
11+
## Guidelines for Text
12+
13+
**Different sections intentionally have different styles.**
14+
15+
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.
16+
17+
**[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.
18+
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.
20+
21+
**[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.
22+
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.
24+
25+
**[Contributing](https://reactjs.org/docs/how-to-contribute.html)** should stay up-to-date and be friendly to relatively experienced developers.
26+
27+
**[FAQ](https://reactjs.org/docs/faq-ajax.html)** has a more conversational tone than the other sections. Here, it's fine to include some content that's not primarily concerned with React, as long as React users are overwhelmingly interested in it (e.g. recommendations on directory structure). It's also okay to show more than a single way to do something in the FAQ, and briefly discuss the tradeoffs. The FAQ prioritizes unblocking people with a working solution over explaining concepts in detail, and can be more opinionated than the rest of the docs, even providing popular library recommendations.
28+
29+
**Try to follow your own instructions.**
30+
31+
When writing step-by-step instructions (e.g. how to install something), try to forget everything you know about the topic, and actually follow the instructions you wrote, a single step at time. Often you will discover that there is implicit knowledge that you forgot to mention, or that there are missing or out-of-order steps in the instructions. Bonus points for getting *somebody else* to follow the steps and watching what they struggle with. Often it would be something very simple that you have not anticipated.
32+
33+
## Guidelines for Code Examples
34+
35+
### Syntax
36+
37+
**Prefer JSX to `createElement`.**
38+
39+
Ignore this if you're specifically describing `createElement`.
40+
41+
**Use `const` where possible, otherwise `let`. Don't use `var`.**
42+
43+
Ignore this if you're specifically writing about ES5.
44+
45+
**Don't use ES6 features when equivalent ES5 features have no downsides.**
46+
47+
Remember that ES6 is still new to a lot of people. While we use it in many places (`const` / `let`, classes, arrow functions), if the equivalent ES5 code is just as straightforward and readable, consider using it.
48+
49+
In particular, you should prefer named `function` declarations over `const myFunction = () => ...` arrows for top-level functions. However, you *should* use arrow functions where they provide a tangible improvement (such as preserving `this` context inside a component). Consider both sides of the tradeoff when deciding whether to use a new feature.
50+
51+
**Don't use features that aren't standardized yet.**
52+
53+
For example, **don't** write this:
54+
55+
```js
56+
class MyComponent extends React.Component {
57+
state = {value: ''};
58+
handleChange = (e) => {
59+
this.setState({value: e.target.value});
60+
};
61+
}
62+
```
63+
64+
Instead, **do** write this:
65+
66+
```js
67+
class MyComponent extends React.Component {
68+
constructor(props) {
69+
super(props)
70+
this.handleChange = this.handleChange.bind(this);
71+
this.state = {value: ''};
72+
}
73+
handleChange(e) {
74+
this.setState({value: e.target.value});
75+
}
76+
}
77+
```
78+
79+
Ignore this rule if you're specifically describing an experimental proposal. Make sure to mention its experimental nature in the code and in the surrounding text.
80+
81+
### Style
82+
83+
- Use semicolons.
84+
- No space between function names and parens (`method() {}` not `method () {}`).
85+
- When in doubt, use the default style favored by [Prettier](https://prettier.io/playground/).
86+
87+
### Highlighting
88+
89+
Use `js` as the highlighting language in Markdown code blocks:
90+
91+
````
92+
```js
93+
// code
94+
```
95+
````
96+
97+
Sometimes you'll see blocks with numbers.
98+
They tell the website to highlight specific lines.
99+
100+
You can highlight a single line:
101+
102+
````
103+
```js{2}
104+
function hello() {
105+
// this line will get highlighted
106+
}
107+
```
108+
````
109+
110+
A range of lines:
111+
112+
````
113+
```js{2-4}
114+
function hello() {
115+
// these lines
116+
// will get
117+
// highlighted
118+
}
119+
```
120+
````
121+
122+
Or even multiple ranges:
123+
124+
````
125+
```js{2-4,6}
126+
function hello() {
127+
// these lines
128+
// will get
129+
// highlighted
130+
console.log('hello');
131+
// also this one
132+
console.log('there');
133+
}
134+
```
135+
````
136+
137+
Be mindful that if you move some code in an example with highlighting, you also need to update the highlighting.
138+
139+
Don't be afraid to often use highlighting! It is very valuable when you need to focus the reader's attention on a particular detail that's easy to miss.

Diff for: content/blog/2015-07-03-react-v0.14-beta-1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This week, many people in the React community are at [ReactEurope](https://www.r
77

88
With React 0.14, we're continuing to let React mature and to make minor changes as the APIs continue to settle down. I'll talk only about the two largest changes in this blog post; when we publish the final release we'll be sure to update all of our documentation and include a full changelog.
99

10-
You can install the new beta with `npm install [email protected]` and `npm install [email protected]`. As mentioned in [Deprecating react-tools](https://reactjs.org/blog/2015/06/12/deprecating-jstransform-and-react-tools.html), we're no longer updating the react-tools package so this release doesn't include a new version of it. Please try the new version out and let us know what you think, and please do file issues on our GitHub repo if you run into any problems.
10+
You can install the new beta with `npm install [email protected]` and `npm install [email protected]`. As mentioned in [Deprecating react-tools](/blog/2015/06/12/deprecating-jstransform-and-react-tools.html), we're no longer updating the react-tools package so this release doesn't include a new version of it. Please try the new version out and let us know what you think, and please do file issues on our GitHub repo if you run into any problems.
1111

1212
## Two Packages
1313

Diff for: content/blog/2017-04-07-react-v15.5.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jscodeshift -t react-codemod/transforms/React-PropTypes-to-prop-types.js <path>
6363

6464
The `propTypes`, `contextTypes`, and `childContextTypes` APIs will work exactly as before. The only change is that the built-in validators now live in a separate package.
6565

66-
You may also consider using [Flow](https://flow.org/) to statically type check your JavaScript code, including [React components](https://flow.org/en/docs/frameworks/react/#setup-flow-with-react-a-classtoc-idtoc-setup-flow-with-react-hreftoc-setup-flow-with-reacta).
66+
You may also consider using [Flow](https://flow.org/) to statically type check your JavaScript code, including [React components](https://flow.org/en/docs/react/components/).
6767

6868
### Migrating from React.createClass
6969

Diff for: content/blog/2017-09-26-react-v16.0.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ See the [documentation for `ReactDOMServer`](/docs/react-dom-server.html) for mo
7171

7272
### Support for custom DOM attributes
7373

74-
Instead of ignoring unrecognized HTML and SVG attributes, React will now [pass them through to the DOM](https://reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html). This has the added benefit of allowing us to get rid of most of React's attribute whitelist, resulting in reduced file sizes.
74+
Instead of ignoring unrecognized HTML and SVG attributes, React will now [pass them through to the DOM](/blog/2017/09/08/dom-attributes-in-react-16.html). This has the added benefit of allowing us to get rid of most of React's attribute whitelist, resulting in reduced file sizes.
7575

7676
### Reduced file size
7777

@@ -135,7 +135,7 @@ Refer to the documentation for [detailed installation instructions](/docs/instal
135135
Although React 16 includes significant internal changes, in terms of upgrading, you can think of this like any other major React release. We've been serving React 16 to Facebook and Messenger.com users since earlier this year, and we released several beta and release candidate versions to flush out additional issues. With minor exceptions, **if your app runs in 15.6 without any warnings, it should work in 16.**
136136

137137
For deprecations listed in [packaging](#packaging) below, codemods are provided to automatically transform your deprecated code.
138-
See the [15.5.0](https://reactjs.org/blog/2017/04/07/react-v15.5.0.html) blog post for more information, or browse the codemods in the [react-codemod](https://github.com/reactjs/react-codemod) project.
138+
See the [15.5.0](/blog/2017/04/07/react-v15.5.0.html) blog post for more information, or browse the codemods in the [react-codemod](https://github.com/reactjs/react-codemod) project.
139139

140140
### New deprecations
141141

@@ -171,7 +171,7 @@ React 16 includes a number of small breaking changes. These only affect uncommon
171171

172172
* There is no `react/lib/*` and `react-dom/lib/*` anymore. Even in CommonJS environments, React and ReactDOM are precompiled to single files (“flat bundles”). If you previously relied on undocumented React internals, and they don’t work anymore, let us know about your specific case in a new issue, and we’ll try to figure out a migration strategy for you.
173173
* There is no `react-with-addons.js` build anymore. All compatible addons are published separately on npm, and have single-file browser versions if you need them.
174-
* The deprecations introduced in 15.x have been removed from the core package. `React.createClass` is now available as `create-react-class`, `React.PropTypes` as `prop-types`, `React.DOM` as `react-dom-factories`, `react-addons-test-utils` as `react-dom/test-utils`, and shallow renderer as `react-test-renderer/shallow`. See [15.5.0](https://reactjs.org/blog/2017/04/07/react-v15.5.0.html) and [15.6.0](https://reactjs.org/blog/2017/06/13/react-v15.6.0.html) blog posts for instructions on migrating code and automated codemods.
174+
* The deprecations introduced in 15.x have been removed from the core package. `React.createClass` is now available as `create-react-class`, `React.PropTypes` as `prop-types`, `React.DOM` as `react-dom-factories`, `react-addons-test-utils` as `react-dom/test-utils`, and shallow renderer as `react-test-renderer/shallow`. See [15.5.0](/blog/2017/04/07/react-v15.5.0.html) and [15.6.0](/blog/2017/06/13/react-v15.6.0.html) blog posts for instructions on migrating code and automated codemods.
175175
* The names and paths to the single-file browser builds have changed to emphasize the difference between development and production builds. For example:
176176
* `react/dist/react.js``react/umd/react.development.js`
177177
* `react/dist/react.min.js``react/umd/react.production.min.js`
@@ -197,12 +197,11 @@ ReactDOM.render(
197197
);
198198
```
199199

200-
React also depends on `requestAnimationFrame` (even in test environments). A simple shim for test environments would be:
200+
React also depends on `requestAnimationFrame` (even in test environments).
201+
You can use the [raf](https://www.npmjs.com/package/raf) package to shim `requestAnimationFrame`:
201202

202203
```js
203-
global.requestAnimationFrame = function(callback) {
204-
setTimeout(callback, 0);
205-
};
204+
import 'raf/polyfill';
206205
```
207206

208207
## Acknowledgments

Diff for: content/community/articles.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
id: articles
3+
title: Articles
4+
layout: community
5+
sectionid: community
6+
permalink: community/articles.html
7+
---
8+
9+
- [React How-to](https://github.com/petehunt/react-howto) - Pete Hunt's guide to the React ecosystem.
10+
- [9 things every React.js beginner should know](https://camjackson.net/post/9-things-every-reactjs-beginner-should-know) - Cam Jackson's guide for beginners.
11+
- [React "Aha" Moments](https://tylermcginnis.com/react-aha-moments/) - Tyler McGinnis' article on his collection of "Aha" moments with React.
12+
- [You're missing the point of React](https://medium.com/@dan_abramov/youre-missing-the-point-of-react-a20e34a51e1a) - Dan Abramov's article about the best parts of React.
13+
- [Timeline for Learning React](https://daveceddia.com/timeline-for-learning-react/) - Dave Ceddia's reccommended timeline for learning React and the React ecosystem.
14+
- [Simple React Development in 2017](https://hackernoon.com/simple-react-development-in-2017-113bd563691f) - Joshua Comeau's guide to showcase how easy it can be to start modern React development.
15+
- [React FAQ](https://reactfaq.site/) - An external site with articles that try to answer frequently asked questions about React.
16+
- [Visual Guide to State in React](https://daveceddia.com/visual-guide-to-state-in-react/) - Dave Ceddia's visual guide to React state.

Diff for: content/community/conferences.md

+23-15
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,9 @@ permalink: community/conferences.html
77
redirect_from: "docs/conferences.html"
88
---
99

10-
## Upcoming Conferences
11-
12-
### React Summit 2017
13-
October 21 in Lagos, Nigeria
14-
15-
[Website](https://reactsummit2017.splashthat.com/) - [Twitter](https://twitter.com/DevCircleLagos/) - [Facebook](https://www.facebook.com/groups/DevCLagos/)
16-
17-
### ReactiveConf 2017
18-
October 25–27, Bratislava, Slovakia
10+
Do you know of a local React.js conference? Add it here! (Please keep the list chronological)
1911

20-
[Website](https://reactiveconf.com)
21-
22-
### React Seoul 2017
23-
November 4 in Seoul, South Korea
24-
25-
[Website](http://seoul.reactjs.kr/en)
12+
## Upcoming Conferences
2613

2714
### React Day Berlin
2815
December 2, Berlin, Germany
@@ -44,6 +31,11 @@ May 17-18 in Paris, France
4431

4532
[Website](https://www.react-europe.org) - [Twitter](https://twitter.com/ReactEurope) - [Facebook](https://www.facebook.com/ReactEurope)
4633

34+
### ReactNext 2018
35+
September 6 in Tel Aviv, Israel
36+
37+
[Website](https://react-next.com) - [Twitter](https://twitter.com/ReactNext) - [Facebook](https://facebook.com/ReactNext2016)
38+
4739
### ReactJS Day 2018
4840
October 5 in Verona, Italy
4941

@@ -182,3 +174,19 @@ October 7 in Sao Paulo, Brazil
182174
October 13 in Stockholm, Sweden
183175

184176
[Website](https://statejs.com/)
177+
178+
### React Summit 2017
179+
October 21 in Lagos, Nigeria
180+
181+
[Website](https://reactsummit2017.splashthat.com/) - [Twitter](https://twitter.com/DevCircleLagos/) - [Facebook](https://www.facebook.com/groups/DevCLagos/)
182+
183+
### ReactiveConf 2017
184+
October 25–27, Bratislava, Slovakia
185+
186+
[Website](https://reactiveconf.com)
187+
188+
### React Seoul 2017
189+
November 4 in Seoul, South Korea
190+
191+
[Website](http://seoul.reactjs.kr/en)
192+

Diff for: content/community/courses.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
id: courses
3+
title: Courses
4+
layout: community
5+
sectionid: community
6+
permalink: community/courses.html
7+
---
8+
9+
## Free Courses
10+
11+
- [Codecademy: React 101](https://www.codecademy.com/learn/react-101) - Codecademy's introductory course for React.
12+
13+
- [Egghead.io: Start Learning React](https://egghead.io/courses/start-learning-react) - This series will explore the basic fundamentals of React to get you started.
14+
15+
- [React Armory: Learn React by Itself](https://reactarmory.com/guides/learn-react-by-itself) - With React Armory, you can learn React without the buzzwords.
16+
17+
- [The Road to Learn React](https://www.robinwieruch.de/the-road-to-learn-react/) - Build a real world application in plain React without complicated tooling.
18+
19+
## Paid Courses
20+
21+
- [Egghead.io](https://egghead.io/browse/frameworks/react) - Short instructional videos on React and many other topics.
22+
23+
- [Frontend Masters](https://frontendmasters.com/courses/) - Video courses on React and other frontend frameworks.
24+
25+
- [Fullstack React](https://www.fullstackreact.com/) - The up-to-date, in-depth, complete guide to React and friends.
26+
27+
- [Pure React](https://daveceddia.com/pure-react/) - A step-by-step guide to mastering React.
28+
29+
- [React for Beginners](https://reactforbeginners.com/) - Learn React in just a couple of afternoons.
30+
31+
- [React Training: Advanced React.js](https://courses.reacttraining.com/p/advanced-react) - Take your React skills to the next level.
32+
33+
- [Tyler McGinnis](https://tylermcginnis.com/courses) - Tyler McGinnis provides access to his courses for a monthly fee. Courses include "React Fundamentals" and "Universal React".

0 commit comments

Comments
 (0)