Skip to content

Commit f66fd9f

Browse files
Merge pull request #33 from reactjs/sync-99a18287
Sync with reactjs.org @ 99a1828
2 parents 1193cc2 + a57b92d commit f66fd9f

13 files changed

+50
-33
lines changed

content/community/conferences.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c
1212

1313
## Upcoming Conferences {#upcoming-conferences}
1414

15-
### React Summit 2019 {#reactsummit2019}
16-
November 30, 2019 in Lagos, Nigeria
17-
18-
[Website](https://reactsummit2019.splashthat.com) -[Twitter](https://twitter.com/react_summit)
19-
20-
### React Day Berlin 2019 {#react-day-berlin-2019}
21-
December 6, 2019 in Berlin, Germany
22-
23-
[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://www.youtube.com/reactdayberlin)
24-
2515
### React Barcamp Cologne 2020 {#react-barcamp-cologne-2020}
2616
February 1-2, 2020 in Cologne, Germany
2717

@@ -82,6 +72,15 @@ July 17, 2020. New York City, USA.
8272

8373
[Website](https://reactweek.nyc/) - [Twitter](https://twitter.com/reactweek) - [Facebook](https://www.facebook.com/reactweek)
8474

75+
### ComponentsConf 2020 {#components20}
76+
September 1, 2020 in Melbourne, Australia
77+
78+
[Website](https://www.componentsconf.com.au/) - [Twitter](https://twitter.com/ComponentsConf) - [Facebook](https://www.facebook.com/ComponentsConf/) - [LinkedIn](https://www.linkedin.com/company/componentsconf/) - [YouTube](https://www.youtube.com/ComponentsConf)
79+
80+
### React India 2020 {#react-india-2020}
81+
November 6, 2020 in Mumbai, India
82+
83+
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia/) - [LinkedIn](https://www.linkedin.com/showcase/14545585) - [YouTube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w/videos)
8584

8685
## Past Conferences {#past-conferences}
8786

@@ -476,3 +475,14 @@ October 25, 2019 in London, UK
476475
October 19, 2019 in São Paulo, BR
477476

478477
[Website](https://reactconf.com.br/) - [Twitter](https://twitter.com/reactconfbr) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Slack](https://react.now.sh/)
478+
479+
### React Summit 2019 {#reactsummit2019}
480+
November 30, 2019 in Lagos, Nigeria
481+
482+
[Website](https://reactsummit2019.splashthat.com) -[Twitter](https://twitter.com/react_summit)
483+
484+
### React Day Berlin 2019 {#react-day-berlin-2019}
485+
December 6, 2019 in Berlin, Germany
486+
487+
[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://www.youtube.com/reactdayberlin)
488+

content/community/meetups.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
173173
* [Portland, OR - ReactJS](https://www.meetup.com/Portland-ReactJS/)
174174
* [Provo, UT - ReactJS](https://www.meetup.com/ReactJS-Utah/)
175175
* [Sacramento, CA - ReactJS](https://www.meetup.com/Sacramento-ReactJS-Meetup/)
176+
* [San Diego, CA - San Diego JS](https://www.meetup.com/sandiegojs/)
176177
* [San Francisco - Real World React](https://www.meetup.com/Real-World-React)
177178
* [San Francisco - ReactJS](https://www.meetup.com/ReactJS-San-Francisco/)
178179
* [San Francisco, CA - React Native](https://www.meetup.com/React-Native-San-Francisco/)

content/docs/context.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function Page(props) {
106106

107107
This pattern is sufficient for many cases when you need to decouple a child from its immediate parents. You can take it even further with [render props](/docs/render-props.html) if the child needs to communicate with the parent before rendering.
108108

109-
However, sometimes the same data needs to be accessible by many components in the tree, and at different nesting levels. Context lets you "broadcast" such data, and changes to it, to all components below. Common examples where using context might be simpler than the alternatives include managing the current locale, theme, or a data cache.
109+
However, sometimes the same data needs to be accessible by many components in the tree, and at different nesting levels. Context lets you "broadcast" such data, and changes to it, to all components below. Common examples where using context might be simpler than the alternatives include managing the current locale, theme, or a data cache.
110110

111111
## API {#api}
112112

@@ -130,12 +130,12 @@ Every Context object comes with a Provider React component that allows consuming
130130

131131
Accepts a `value` prop to be passed to consuming components that are descendants of this Provider. One Provider can be connected to many consumers. Providers can be nested to override values deeper within the tree.
132132

133-
All consumers that are descendants of a Provider will re-render whenever the Provider's `value` prop changes. The propagation from Provider to its descendant consumers is not subject to the `shouldComponentUpdate` method, so the consumer is updated even when an ancestor component bails out of the update.
133+
All consumers that are descendants of a Provider will re-render whenever the Provider's `value` prop changes. The propagation from Provider to its descendant consumers (including [`.contextType`](#classcontexttype) and [`useContext`](/docs/hooks-reference.html#usecontext)) is not subject to the `shouldComponentUpdate` method, so the consumer is updated even when an ancestor component skips an update.
134134

135-
Changes are determined by comparing the new and old values using the same algorithm as [`Object.is`](//developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#Description).
135+
Changes are determined by comparing the new and old values using the same algorithm as [`Object.is`](//developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#Description).
136136

137137
> Note
138-
>
138+
>
139139
> The way changes are determined can cause some issues when passing objects as `value`: see [Caveats](#caveats).
140140
141141
### `Class.contextType` {#classcontexttype}
@@ -194,7 +194,7 @@ A React component that subscribes to context changes. This lets you subscribe to
194194
Requires a [function as a child](/docs/render-props.html#using-props-other-than-render). The function receives the current context value and returns a React node. The `value` argument passed to the function will be equal to the `value` prop of the closest Provider for this context above in the tree. If there is no Provider for this context above, the `value` argument will be equal to the `defaultValue` that was passed to `createContext()`.
195195

196196
> Note
197-
>
197+
>
198198
> For more information about the 'function as a child' pattern, see [render props](/docs/render-props.html).
199199
200200
### `Context.displayName` {#contextdisplayname}
@@ -241,7 +241,7 @@ It is often necessary to update the context from a component that is nested some
241241

242242
### Consuming Multiple Contexts {#consuming-multiple-contexts}
243243

244-
To keep context re-rendering fast, React needs to make each context consumer a separate node in the tree.
244+
To keep context re-rendering fast, React needs to make each context consumer a separate node in the tree.
245245

246246
`embed:context/multiple-contexts.js`
247247

@@ -261,6 +261,6 @@ To get around this, lift the value into the parent's state:
261261
## Legacy API {#legacy-api}
262262

263263
> Note
264-
>
264+
>
265265
> React previously shipped with an experimental context API. The old API will be supported in all 16.x releases, but applications using it should migrate to the new version. The legacy API will be removed in a future major React version. Read the [legacy context docs here](/docs/legacy-context.html).
266-
266+

content/docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Ha a saját kódszerkesztődet használnád, [letöltheted ezt a HTML fájlt](ht
4848

4949
Ha egy új React projektbe kezdesz, egy [egyszerű HTML oldal script tagekkel](/docs/add-react-to-a-website.html) lehet a legjobb megoldás. Csak egy percbe telik beállítani!
5050

51-
Ahogy az alkalmazásod nőni kezd, elkezdhetsz gondolkodni egy integráltabb megoldásban. Többféle [JavaScript eszközlánc is létezik](/docs/create-a-new-react-app.html), amit nagyobb alkamazásokhoz ajánlunk. Ezek mindegyike csak kevés vagy szinte semmilyen konfigurációt nem igényel és segítségükkel teljes hozzáférést nyersz a gazdag React ökoszisztémához.
51+
Ahogy az alkalmazásod nőni kezd, elkezdhetsz gondolkodni egy integráltabb megoldásban. Többféle JavaScript eszközláncot is ajánlunk nagyobb alkalmazásokhoz. Ezek mindegyike csak kevés vagy szinte semmilyen konfigurációt nem igényel és segítségükkel teljes hozzáférést nyersz a gazdag React ökoszisztémához. [Tanuld meg hogyan.](/docs/create-a-new-react-app.html)
5252

5353
## Tanuld meg a Reactet {#learn-react}
5454

content/docs/hooks-faq.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ Here, we store the previous value of the `row` prop in a state variable so that
428428

429429
```js
430430
function ScrollView({row}) {
431-
let [isScrollingDown, setIsScrollingDown] = useState(false);
432-
let [prevRow, setPrevRow] = useState(null);
431+
const [isScrollingDown, setIsScrollingDown] = useState(false);
432+
const [prevRow, setPrevRow] = useState(null);
433433

434434
if (row !== prevRow) {
435435
// Row changed since last render. Update isScrollingDown.
@@ -465,7 +465,7 @@ While you shouldn't need this often, you may expose some imperative methods to a
465465

466466
### How can I measure a DOM node? {#how-can-i-measure-a-dom-node}
467467

468-
In order to measure the position or size of a DOM node, you can use a [callback ref](/docs/refs-and-the-dom.html#callback-refs). React will call that callback whenever the ref gets attached to a different node. Here is a [small demo](https://codesandbox.io/s/l7m0v5x4v9):
468+
One rudimentary way to measure the position or size of a DOM node is to use a [callback ref](/docs/refs-and-the-dom.html#callback-refs). React will call that callback whenever the ref gets attached to a different node. Here is a [small demo](https://codesandbox.io/s/l7m0v5x4v9):
469469

470470
```js{4-8,12}
471471
function MeasureExample() {
@@ -490,6 +490,8 @@ We didn't choose `useRef` in this example because an object ref doesn't notify u
490490

491491
Note that we pass `[]` as a dependency array to `useCallback`. This ensures that our ref callback doesn't change between the re-renders, and so React won't call it unnecessarily.
492492

493+
In this example, the callback ref will be called only when the component mounts and unmounts, since the rendered `<h1>` component stays present throughout any rerenders. If you want to be notified any time a component resizes, you may want to use [`ResizeObserver`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) or a third-party Hook built on it.
494+
493495
If you want, you can [extract this logic](https://codesandbox.io/s/m5o42082xy) into a reusable Hook:
494496

495497
```js{2}
@@ -716,7 +718,7 @@ As a last resort, if you want something like `this` in a class, you can [use a r
716718
```js{2-6,10-11,16}
717719
function Example(props) {
718720
// Keep latest props in a ref.
719-
let latestProps = useRef(props);
721+
const latestProps = useRef(props);
720722
useEffect(() => {
721723
latestProps.current = props;
722724
});

content/docs/hooks-reference.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function Counter({initialCount}) {
6969

7070
The "+" and "-" buttons use the functional form, because the updated value is based on the previous value. But the "Reset" button uses the normal form, because it always sets the count back to the initial value.
7171

72+
If your update function returns the exact same value, the subsequent rerender will be skipped completely.
73+
7274
> Note
7375
>
7476
> Unlike the `setState` method found in class components, `useState` does not automatically merge update objects. You can replicate this behavior by combining the function updater form with object spread syntax:
@@ -180,7 +182,7 @@ const value = useContext(MyContext);
180182

181183
Accepts a context object (the value returned from `React.createContext`) and returns the current context value for that context. The current context value is determined by the `value` prop of the nearest `<MyContext.Provider>` above the calling component in the tree.
182184

183-
When the nearest `<MyContext.Provider>` above the component updates, this Hook will trigger a rerender with the latest context `value` passed to that `MyContext` provider.
185+
When the nearest `<MyContext.Provider>` above the component updates, this Hook will trigger a rerender with the latest context `value` passed to that `MyContext` provider. Even if an ancestor uses [`React.memo`](/docs/react-api.html#reactmemo) or [`shouldComponentUpdate`](/docs/react-component.html#shouldcomponentupdate), a rerender will still happen starting at the component itself using `useContext`.
184186

185187
Don't forget that the argument to `useContext` must be the *context object itself*:
186188

content/docs/hooks-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ npm install eslint-plugin-react-hooks --save-dev
4646
}
4747
```
4848

49-
In the future, we intend to include this plugin by default into Create React App and similar toolkits.
49+
This plugin is included by default in [Create React App](/docs/create-a-new-react-app.html#create-react-app).
5050

5151
**You can skip to the next page explaining how to write [your own Hooks](/docs/hooks-custom.html) now.** On this page, we'll continue by explaining the reasoning behind these rules.
5252

content/docs/introducing-jsx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,4 @@ A következő szekcióban megvizsgáljuk a React elemek DOM-ba való renderelés
181181

182182
>**Tipp:**
183183
>
184-
>Javasoljuk, hogy általad használt kódszerkesztőben használd a ["Babel" nyelvdefiníciót](https://babeljs.io/docs/editors), így az ES6 és JSX kódrészek is helyesen lesznek kiemelve. Ez a weboldal az [Oceanic Next](https://labs.voronianski.com/oceanic-next-color-scheme/) színsémát használja, ami ezzel kompatibilis.
184+
>Javasoljuk, hogy általad használt kódszerkesztőben használd a ["Babel" nyelvdefiníciót](https://babeljs.io/docs/editors), így az ES6 és JSX kódrészek is helyesen lesznek kiemelve.

content/docs/optimizing-performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ To do this in Chrome:
176176

177177
6. React events will be grouped under the **User Timing** label.
178178

179-
For a more detailed walkthrough, check out [this article by Ben Schwarz](https://building.calibreapp.com/debugging-react-performance-with-react-16-and-chrome-devtools-c90698a522ad).
179+
For a more detailed walkthrough, check out [this article by Ben Schwarz](https://calibreapp.com/blog/react-performance-profiling-optimization).
180180

181181
Note that **the numbers are relative so components will render faster in production**. Still, this should help you realize when unrelated UI gets updated by mistake, and how deep and how often your UI updates occur.
182182

content/docs/reference-react.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ See the [React.Component API Reference](/docs/react-component.html) for a list o
104104

105105
### `React.PureComponent` {#reactpurecomponent}
106106

107-
`React.PureComponent` is similar to [`React.Component`](#reactcomponent). The difference between them is that [`React.Component`](#reactcomponent) doesn't implement [`shouldComponentUpdate()`](/docs/react-component.html#shouldcomponentupdate), but `React.PureComponent` implements it with a shallow prop and state comparison.
107+
`React.PureComponent` is similar to [`React.Component`](#reactcomponent). The difference between them is that [`React.Component`](#reactcomponent) doesn't implement [`shouldComponentUpdate()`](/docs/react-component.html#shouldcomponentupdate), but `React.PureComponent` implements it with a shallow prop and state comparison.
108108

109109
If your React component's `render()` function renders the same result given the same props and state, you can use `React.PureComponent` for a performance boost in some cases.
110110

@@ -128,6 +128,8 @@ const MyComponent = React.memo(function MyComponent(props) {
128128

129129
If your function component renders the same result given the same props, you can wrap it in a call to `React.memo` for a performance boost in some cases by memoizing the result. This means that React will skip rendering the component, and reuse the last rendered result.
130130

131+
`React.memo` only affects props changes. If your function component wrapped in `React.memo` has a [`useState`](/docs/hooks-state.html) or [`useContext`](/docs/hooks-reference.html#usecontext) Hook in its implementation, it will still rerender when state or context change.
132+
131133
By default it will only shallowly compare complex objects in the props object. If you want control over the comparison, you can also provide a custom comparison function as the second argument.
132134

133135
```javascript

content/docs/refs-and-the-dom.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class CustomTextInput extends React.Component {
140140

141141
#### Refs and Function Components {#refs-and-function-components}
142142

143-
**You may not use the `ref` attribute on function components** because they don't have instances:
143+
By default, **you may not use the `ref` attribute on function components** because they don't have instances:
144144

145145
```javascript{1,8,13}
146146
function MyFunctionComponent() {
@@ -161,7 +161,7 @@ class Parent extends React.Component {
161161
}
162162
```
163163

164-
You should convert the component to a class if you need a ref to it, just like you do when you need lifecycle methods or state.
164+
If you want to allow people to take a `ref` to your function component, you can use [`forwardRef`](https://reactjs.org/docs/forwarding-refs.html) (possibly in conjunction with [`useImperativeHandle`](/docs/hooks-reference.html#useimperativehandle)), or you can convert the component to a class.
165165

166166
You can, however, **use the `ref` attribute inside a function component** as long as you refer to a DOM element or a class component:
167167

content/docs/testing-environments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ Sometimes, you may not want to mock timers. For example, maybe you're testing an
5353

5454
### End-to-end tests {#end-to-end-tests-aka-e2e-tests}
5555

56-
End-to-end tests are useful for testing longer workflows, especially when they're critical to your business (such as payments or signups). For these tests, you'd probably want to test both how a real browser renders the whole app, fetches data from the real API endpoints, uses sessions and cookies, navigates between different links. You might also likely want to make assertions not just on the DOM state, but on the backing data as well (e.g. to verify whether the updates have been persisted to the database).
56+
End-to-end tests are useful for testing longer workflows, especially when they're critical to your business (such as payments or signups). For these tests, you'd probably want to test how a real browser renders the whole app, fetches data from the real API endpoints, uses sessions and cookies, navigates between different links. You might also likely want to make assertions not just on the DOM state, but on the backing data as well (e.g. to verify whether the updates have been persisted to the database).
5757

5858
In this scenario, you would use a framework like [Cypress](https://www.cypress.io/) or a library like [puppeteer](https://github.com/GoogleChrome/puppeteer) so you can navigate between multiple routes and assert on side effects not just in the browser, but potentially on the backend as well.

content/docs/testing-recipes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,14 +396,14 @@ it("changes value when clicked", () => {
396396
397397
// get ahold of the button element, and trigger some clicks on it
398398
const button = document.querySelector("[data-testid=toggle]");
399-
expect(button.innerHTML).toBe("Turn off");
399+
expect(button.innerHTML).toBe("Turn on");
400400
401401
act(() => {
402402
button.dispatchEvent(new MouseEvent("click", { bubbles: true }));
403403
});
404404
405405
expect(onChange).toHaveBeenCalledTimes(1);
406-
expect(button.innerHTML).toBe("Turn on");
406+
expect(button.innerHTML).toBe("Turn off");
407407
408408
act(() => {
409409
for (let i = 0; i < 5; i++) {

0 commit comments

Comments
 (0)