Skip to content

Commit

Permalink
Merge pull request #416 from reactjs/sync-68e4efcf
Browse files Browse the repository at this point in the history
Sync with reactjs.org @ 68e4efc
  • Loading branch information
koba04 committed Jun 15, 2021
2 parents d692a70 + 7d0a973 commit f845590
Show file tree
Hide file tree
Showing 18 changed files with 86 additions and 109 deletions.
2 changes: 1 addition & 1 deletion README.md
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
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
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
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
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
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
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
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
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
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
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
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
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
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

0 comments on commit f845590

Please sign in to comment.