Skip to content

Sync with reactjs.org @ 68e4efcf #416

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
merged 26 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3bff1ac
update on RN and react 17 (#3620)
pvinis Apr 8, 2021
968f091
update Optimizing Performance section (#3605) (#3623)
ethanyang163 Apr 12, 2021
cf0f0f9
docs: Fix broken links to React Conf videos (#3629)
orama254 Apr 14, 2021
cde1783
docs: Add react learning path on frontend masters link (#3628)
orama254 Apr 15, 2021
446345c
fixing typo in tutorial readme (#3639)
nancyheiss Apr 16, 2021
8e0ed8f
Removed createBlockingRoot API docs and added a warning note (#3642)
Apr 19, 2021
420c397
Update code-splitting.md (setup → set up) (#3643)
Apr 20, 2021
8251eab
`lifecycle` -> `lifecycle method` (#3650)
danield770 Apr 22, 2021
5119600
Include where `setState` is comming from (#3652)
m019m1 Apr 22, 2021
c3c93e2
added hyperlink for Netlify (#3445)
nkalinos Apr 27, 2021
16158f1
Update devtools screenshot to latest version (#3670)
skaidra-bake May 6, 2021
5201abf
Bump lodash from 4.17.20 to 4.17.21 (#3680)
dependabot[bot] May 12, 2021
12b08e4
Update addons-test-utils.md (#3660)
intrepidOlivia May 14, 2021
abcf035
Add React Advanced London 2021 - in-person + remote (#3686)
robhrt7 May 14, 2021
a5e0bf4
grammatical typo fix on allowlist (#3689)
khjabir May 19, 2021
e60bca0
Fixed a minor typo in a comment (#3685)
omasher May 21, 2021
91cfb4e
Change example to use a <form> (#3697)
gaearon May 25, 2021
f6c2e06
Bump browserslist from 4.14.3 to 4.16.6 (#3699)
dependabot[bot] May 26, 2021
ec2d0ad
Updating name of variable to which returned value of setState is assi…
avinasx May 28, 2021
6618bcc
Fix broken link to devtools (#3715)
tupini07 May 31, 2021
ff68780
Fixed typo inside concurrent-mode-reference.md (#3716)
tfrank11 May 31, 2021
68e4efc
Added missing comma and removed a few redundant words (#3725)
lukeingalls Jun 7, 2021
80d99c2
Resolve conflicts of yarn.lock, merging all other conflicts
smikitky Jun 13, 2021
2de5df8
Resolve conflicts
smikitky Jun 13, 2021
2235617
Address suggesion in code review
smikitky Jun 15, 2021
7d0a973
Translate warning
smikitky Jun 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The documentation is divided into several sections with a different tone and pur
1. `git push my-fork-name the-name-of-my-branch`
1. Go to the [ja.reactjs.org repo](https://github.com/reactjs/ja.reactjs.org) and you should see recently pushed branches.
1. Follow GitHub's instructions.
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.
1. If possible, include screenshots of visual changes. A [Netlify](https://www.netlify.com/) build will also be automatically created once you make your PR so other people can see your change.

## Translation

Expand Down
2 changes: 1 addition & 1 deletion content/blog/2017-09-08-dom-attributes-in-react-16.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ React has always provided a JavaScript-centric API to the DOM. Since React compo
<div tabIndex={-1} />
```

This has not changed. However, the way we enforced it in the past forced us to maintain a allowlist of all valid React DOM attributes in the bundle:
This has not changed. However, the way we enforced it in the past forced us to maintain an allowlist of all valid React DOM attributes in the bundle:

```js
// ...
Expand Down
2 changes: 1 addition & 1 deletion content/blog/2020-10-20-react-v17.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Raect 17 は[新しい JSX トランスフォーム](/blog/2020/09/22/introducin

## React Native {#react-native}

React Native のリリーススケジュールは React と異なっています。現在のところ React Native 0.65 において React 17 のサポートが入ることを期待していますが、正確なバージョンについては変わる可能性があります。いつものように、リリースに関する議論は React Native Community のリリースに関する[イシュートラッカ](https://github.com/react-native-community/releases)で追うことができます。
React Native のリリーススケジュールは React と異なっています。React 17 へのサポートは React Native 0.64 にて追加されました。いつものように、リリースに関する議論は React Native Community のリリースに関する[イシュートラッカ](https://github.com/react-native-community/releases)で追うことができます。

## インストール {#installation}

Expand Down
33 changes: 19 additions & 14 deletions content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,37 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c

## Upcoming Conferences {#upcoming-conferences}

### React fwdays’21 {#react-fwdays-2021}
March 27, 2021 - remote event
### render(ATL) 2021 {#render-atlanta-2021}
September 13-15, 2021. Atlanta, GA, USA

[Website](https://fwdays.com/en/event/react-fwdays-2021) - [Twitter](https://twitter.com/fwdays) - [Facebook](https://www.facebook.com/events/1133828147054286) - [LinkedIn](https://www.linkedin.com/events/reactfwdays-21onlineconference6758046347334582273) - [Meetup](https://www.meetup.com/ru-RU/Fwdays/events/275764431/)
[Website](https://renderatl.com) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl)

### React Summit - Remote Edition 2021 {#react-summit-remote-2021}
April 14-16, 2021, 7am PST / 10am EST / 4pm CEST - remote event
### React Advanced 2021 {#react-advanced-2021}
October 22-23, 2021. In-person in London, UK + remote (hybrid event)

[Website](https://remote.reactsummit.com) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://youtube.com/c/ReactConferences)
[Website](https://reactadvanced.com) - [Twitter](http://twitter.com/reactadvanced) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Videos](https://youtube.com/c/ReactConferences)

### React India 2021 {#react-india-2021}
November 12-13, 2021 in Mumbai, India

[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)

## Past Conferences {#past-conferences}

### React Case Study Festival 2021 {#react-case-study-festival-2021}
April 27-28, 2021 - remote event

[Website](https://link.geekle.us/react/offsite) - [LinkedIn](https://www.linkedin.com/events/reactcasestudyfestival6721300943411015680/) - [Facebook](https://www.facebook.com/events/255715435820203)

### render(ATL) 2021 {#render-atlanta-2021}
September 13-15, 2021. Atlanta, GA, USA

[Website](https://renderatl.com) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl)
### React Summit - Remote Edition 2021 {#react-summit-remote-2021}
April 14-16, 2021, 7am PST / 10am EST / 4pm CEST - remote event

### React India 2021 {#react-india-2021}
November 12-13, 2021 in Mumbai, India
[Website](https://remote.reactsummit.com) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://youtube.com/c/ReactConferences)

[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)
### React fwdays’21 {#react-fwdays-2021}
March 27, 2021 - remote event

## Past Conferences {#past-conferences}
[Website](https://fwdays.com/en/event/react-fwdays-2021) - [Twitter](https://twitter.com/fwdays) - [Facebook](https://www.facebook.com/events/1133828147054286) - [LinkedIn](https://www.linkedin.com/events/reactfwdays-21onlineconference6758046347334582273) - [Meetup](https://www.meetup.com/ru-RU/Fwdays/events/275764431/)

### React Next 2020 {#react-next-2020}
December 1-2, 2020 - remote event
Expand Down
2 changes: 1 addition & 1 deletion content/community/courses.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ permalink: community/courses.html

- [Egghead.io](https://egghead.io/browse/frameworks/react) - Short instructional videos on React and many other topics.

- [Frontend Masters](https://frontendmasters.com/courses/) - Video courses on React and other frontend frameworks.
- [Frontend Masters](https://frontendmasters.com/learn/react/) - Video courses on React.

- [Fullstack React](https://www.fullstackreact.com/) - The up-to-date, in-depth, complete guide to React and friends.

Expand Down
4 changes: 2 additions & 2 deletions content/community/videos.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Videos dedicated to the discussion of React and the React ecosystem.
### React Conf 2019 {#react-conf-2019}

A playlist of videos from React Conf 2019.
<iframe title="React Conf 2019" width="650" height="366" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLPxbbTqCLbGHPxZpw4xj_Wwg8-fdNxJRh" frameborder="0" allowfullscreen></iframe>
<iframe title="React Conf 2019" width="650" height="366" src="https://www.youtube-nocookie.com/embed/playlist?list=PLPxbbTqCLbGHPxZpw4xj_Wwg8-fdNxJRh" frameborder="0" allowfullscreen></iframe>

### React Conf 2018 {#react-conf-2018}

A playlist of videos from React Conf 2018.
<iframe title="React Conf 2018" width="650" height="366" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLPxbbTqCLbGE5AihOSExAa4wUM-P42EIJ" frameborder="0" allowfullscreen></iframe>
<iframe title="React Conf 2018" width="650" height="366" src="https://www.youtube-nocookie.com/embed/playlist?list=PLPxbbTqCLbGE5AihOSExAa4wUM-P42EIJ" frameborder="0" allowfullscreen></iframe>

### React.js Conf 2017 {#reactjs-conf-2017}

Expand Down
4 changes: 2 additions & 2 deletions content/docs/addons-test-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm

> 補足:
>
> [`react-testing-library`](https://testing-library.com/react) の使用をおすすめします。これは、エンドユーザがコンポーネントを使用するのと同様の書き方でコンポーネントを使用するテストを書くことを可能にし、かつそれを促進するように設計されています。
> [`react-testing-library`](https://testing-library.com/react) の使用をおすすめします。これは、エンドユーザがコンポーネントを使用するときと同様の方法でコンポーネントを使用するようなテストを書くことを可能にし、かつそれを促進するように設計されています。
>
> また別の手段として、Airbnb が [Enzyme](http://airbnb.io/enzyme/) と呼ばれるテストユーティリティをリリースしています。Enzyme は React コンポーネントの出力のアサート、操作、そして横断的な処理を簡単にしてくれます
> バージョン 16 以下の React を使用している場合、[Enzyme](http://airbnb.io/enzyme/) ライブラリを使うことで React コンポーネントの出力のアサート、操作、そして横断的な処理を簡単に行えます

- [`act()`](#act)
- [`mockComponent()`](#mockcomponent)
Expand Down
4 changes: 4 additions & 0 deletions content/docs/concurrent-mode-adoption.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ next: concurrent-mode-reference.html
>
> このドキュメントは興味のある読者やアーリーアダプター向けのものです。**React が初めての方はこれらの機能を気にしないで構いません** -- 今すぐに学ぶ必要はありません。

>警告:
>
> 「ブロッキングモード」および `createBlockingRoot` に関する以下の記載はすべて古くなっていますので無視するようにしてください。

</div>

- [インストール](#installation)
Expand Down
13 changes: 0 additions & 13 deletions content/docs/concurrent-mode-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ prev: concurrent-mode-adoption.html

- [並列モードの有効化](#concurrent-mode)
- [`createRoot`](#createroot)
- [`createBlockingRoot`](#createblockingroot)
- [サスペンス API](#suspense)
- [`Suspense`](#suspensecomponent)
- [`SuspenseList`](#suspenselist)
Expand All @@ -47,18 +46,6 @@ ReactDOM.createRoot(rootNode).render(<App />);

並列モードについての詳細は[並列モードのドキュメント](/docs/concurrent-mode-intro.html)を参照してください。

### `createBlockingRoot` {#createblockingroot}

```js
ReactDOM.createBlockingRoot(rootNode).render(<App />)
```

`ReactDOM.render(<App />, rootNode)` を置き換えて[ブロッキングモード](/docs/concurrent-mode-adoption.html#migration-step-blocking-mode)を有効化します。

並列モードにオプトインすることで React の動作方法について意味上の変更が加わります。これは少数のコンポーネントだけで並列モードを使うということが不可能であるということを意味します。このため、いくつかのアプリケーションでは並列モードに直接移行することができないかもしれません。

ブロッキングモードには並列モードの機能の小さなサブセットのみが含まれているので、直接的な移行ができないアプリケーションのための中間的な移行ステップとなることを意図しています。

## サスペンス API {#suspense}

### `Suspense` {#suspensecomponent}
Expand Down
2 changes: 1 addition & 1 deletion content/docs/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ redirect_from:
- "docs/forms-zh-CN.html"
---

自然な HTML のフォーム要素は内部に何らかの状態を持っていますので、フォーム要素は React において他の DOM 要素とちょっと異なる動作をします。例えば、このプレーン HTML によるフォームは 1 つの名前を受け付けます:
HTML のフォーム要素は当然のこととして内部に何らかの状態を持っていますので、フォーム要素は React において他の DOM 要素とちょっと異なる動作をします。例えば、このプレーン HTML によるフォームは 1 つの名前を受け付けます:

```html
<form>
Expand Down
26 changes: 13 additions & 13 deletions content/docs/handling-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ React でのイベント処理は DOM 要素のイベントの処理と非常に
</button>
```

別の違いとして、React では `false` を返してもデフォルトの動作を抑止することができません。明示的に `preventDefault` を呼び出す必要があります。例えば、プレーンな HTML では、「新しいページを開く」というリンクのデフォルト動作を抑止するために次のように書くことができます
別の違いとして、React では `false` を返してもデフォルトの動作を抑止することができません。明示的に `preventDefault` を呼び出す必要があります。例えば、プレーンな HTML では、「フォームをサブミットする」という form 要素のデフォルト動作を抑止するために次のように書くことができます

```html
<a href="#" onclick="console.log('The link was clicked.'); return false">
Click me
</a>
<form onsubmit="console.log('You clicked submit.'); return false">
<button type="submit">Submit</button>
</form>
```

React では、代わりに次のようになります:

```js{2-5,8}
function ActionLink() {
function handleClick(e) {
```js{3}
function Form() {
function handleSubmit(e) {
e.preventDefault();
console.log('The link was clicked.');
console.log('You clicked submit.');
}

return (
<a href="#" onClick={handleClick}>
Click me
</a>
<form onSubmit={handleSubmit}>
<button type="submit">Submit</button>
</form>
);
}
```
Expand All @@ -71,8 +71,8 @@ class Toggle extends React.Component {
}

handleClick() {
this.setState(state => ({
isToggleOn: !state.isToggleOn
this.setState(prevState => ({
isToggleOn: !prevState.isToggleOn
}));
}

Expand Down
2 changes: 1 addition & 1 deletion content/docs/higher-order-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const EnhancedComponent = enhance(WrappedComponent)

## 規則:デバッグしやすくするため表示名をラップすること {#convention-wrap-the-display-name-for-easy-debugging}

HOC により作成されたコンテナコンポーネントは他のあらゆるコンポーネントと同様、[React Developer Tools](https://github.com/facebook/react-devtools) に表示されます。デバッグを容易にするため、HOC の結果だと分かるよう表示名を選んでください。
HOC により作成されたコンテナコンポーネントは他のあらゆるコンポーネントと同様、[React Developer Tools](https://github.com/facebook/react/tree/master/packages/react-devtools) に表示されます。デバッグを容易にするため、HOC の結果だと分かるよう表示名を選んでください。

最も一般的な手法は、ラップされるコンポーネントの表示名をラップすることです。つまり高階コンポーネントが `withSubscription` と名付けられ、ラップされるコンポーネントの表示名が `CommentList` である場合、`WithSubscription(CommentList)` という表示名を使用しましょう:

Expand Down
1 change: 1 addition & 0 deletions content/docs/hooks-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function Counter({initialCount}) {
> クラスコンポーネントの `setState` メソッドとは異なり、`useState` は自動的な更新オブジェクトのマージを行いません。この動作は関数型の更新形式をスプレッド構文と併用することで再現可能です:
>
> ```js
> const [state, setState] = useState({});
> setState(prevState => {
> // Object.assign would also work
> return {...prevState, ...updatedValues};
Expand Down
33 changes: 6 additions & 27 deletions content/docs/optimizing-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,33 +156,7 @@ module.exports = {

これらが必要なのは本番用ビルドだけであることに留意してください。React の有用な警告文が隠されたり、ビルド速度が大幅に遅くなったりしますので、開発時には `TerserPlugin` を適用しないでください。

## Chrome のパフォーマンスタブでコンポーネントをプロファイルする {#profiling-components-with-the-chrome-performance-tab}

**開発**モードでは、対応するブラウザのパフォーマンス分析ツールで、コンポーネントのマウント・更新・アンマウントの様子を以下のように視覚化することができます。

<center><img src="../images/blog/react-perf-chrome-timeline.png" style="max-width:100%" alt="React components in Chrome timeline" /></center>

Chrome での操作は以下の通り。

1. 一時的に **React DevTools を含むすべての Chrome 拡張機能を無効にする**。無効にしないと、結果が正確でなくなる可能性があります。

2. アプリケーションが開発モードで動作していることを確認する。

3. Chrome DevTools の[**パフォーマンス**](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/timeline-tool)タブを開いて **Record(記録)** ボタンを押す。

4. プロファイル対象のアクションを実行する。なお、20 秒以上は記録しないでください。さもないと Chrome がハングアップすることがあります。

5. 記録を停止する。

6. React イベントが **User Timing** ラベルの下にグループ化される。

さらなる詳細については、[Ben Schwarz によるこの記事](https://calibreapp.com/blog/react-performance-profiling-optimization)を参照ください。

**プロファイル結果の数値は相対的なものであり、コンポーネントは本番環境ではより速くレンダーされる**ことに注意してください。それでも、無関係な UI 部分が誤って更新されているのを見つけたり、どの程度の頻度と深さで UI の更新が発生するのかを知る手助けになるはずです。

現時点では、Chrome、Edge、そして IE のみがこの機能をサポートするブラウザですが、私達は標準の [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API) を採用しているので、より多くのブラウザがサポートしてくれることを期待しています。

## DevToolsプロファイラを使用したコンポーネントのプロファイリング {#profiling-components-with-the-devtools-profiler}
## DevTools プロファイラを使用したコンポーネントのプロファイリング {#profiling-components-with-the-devtools-profiler}

`react-dom` 16.5 以降と `react-native` 0.57 以降では、開発モードにおける強化されたプロファイリング機能を React DevTools プロファイラにて提供しています。
このプロファイラの概要はブログ記事 ["Introducing the React Profiler"](/blog/2018/09/10/introducing-the-react-profiler.html) で説明されています。
Expand All @@ -199,6 +173,11 @@ React DevTools をまだインストールしていない場合は、以下で
> 本番ビルド版 `react-dom` のプロファイリング可能なバンドルとして `react-dom/profiling` が利用可能です。
> このバンドルの使い方の詳細については、[fb.me/react-profiling](https://fb.me/react-profiling) を参照してください。

> 捕捉
>
> React 17 より前のバージョンでは、標準の [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API) を用いて Chrome のパフォーマンスタブでコンポーネントのプロファイリングが行われていました。
> これについての概要は [Ben Schwarz によるこの記事](https://calibreapp.com/blog/react-performance-profiling-optimization)を参照してください。

## 長いリストの仮想化 {#virtualize-long-lists}

アプリケーションが長いデータのリスト(数百〜数千行)をレンダーする場合は、「ウィンドウイング」として知られるテクニックを使うことをおすすめします。このテクニックでは、ある瞬間ごとにはリストの小さな部分集合のみを描画することで、生成する DOM ノードの数およびコンポーネントの再描画にかかる時間を大幅に削減することができます。
Expand Down
Loading