Skip to content

Commit 4b6ef8a

Browse files
authored
Merge pull request #239 from reactjs/sync-de497e25
Sync with reactjs.org @ de497e2
2 parents ac55dd2 + 9df0651 commit 4b6ef8a

15 files changed

+99
-62
lines changed

content/blog/2015-09-02-new-react-developer-tools.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ It contains a handful of new features, including:
2020

2121
## Installation {#installation}
2222

23-
Download the new devtools from the [Chrome Web Store](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) and on [Mozilla Add-ons](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/) for Firefox. If you're developing using React, we highly recommend installing these devtools.
23+
Download the new devtools from the [Chrome Web Store](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) and on [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/) for Firefox. If you're developing using React, we highly recommend installing these devtools.
2424

2525
If you already have the Chrome extension installed, it should autoupdate within the next week. You can also head to `chrome://extensions` and click "Update extensions now" if you'd like to get the new version today. If you installed the devtools beta, please remove it and switch back to the version from the store to make sure you always get the latest updates and bug fixes.
2626

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "Introducing the New React DevTools"
3+
author: [bvaughn]
4+
---
5+
We are excited to announce a new release of the React Developer Tools, available today in Chrome, Firefox, and (Chromium) Edge!
6+
7+
## What's changed?
8+
9+
A lot has changed in version 4!
10+
At a high level, this new version should offer significant performance gains and an improved navigation experience.
11+
It also offers full support for React Hooks, including inspecting nested objects.
12+
13+
![DevTools version 4 screenshot](../images/blog/devtools-v4-screenshot.png)
14+
15+
[Visit the interactive tutorial](https://react-devtools-tutorial.now.sh/) to try out the new version or [see the changelog](https://github.com/facebook/react/blob/master/packages/react-devtools/CHANGELOG.md#400-august-15-2019) for demo videos and more details.
16+
17+
## Which versions of React are supported?
18+
19+
**`react-dom`**
20+
21+
* `0`-`14.x`: Not supported
22+
* `15.x`: Supported (except for the new component filters feature)
23+
* `16.x`: Supported
24+
25+
**`react-native`**
26+
* `0`-`0.61`: Not supported
27+
* `0.62`: Will be supported (when 0.62 is released)
28+
29+
## How do I get the new DevTools?
30+
31+
React DevTools is available as an extension for [Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) and [Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/).
32+
If you have already installed the extension, it should update automatically within the next couple of hours.
33+
34+
If you use the standalone shell (e.g. in React Native or Safari), you can install the new version [from NPM](https://www.npmjs.com/package/react-devtools):
35+
36+
```shell
37+
npm install -g react-devtools@^4
38+
```
39+
40+
## Where did all of the DOM elements go?
41+
42+
The new DevTools provides a way to filter components from the tree to make it easier to navigate deeply nested hierarchies.
43+
Host nodes (e.g. HTML `<div>`, React Native `<View>`) are *hidden by default*, but this filter can be disabled:
44+
45+
![DevTools component filters](../images/blog/devtools-component-filters.gif)
46+
47+
## How do I get the old version back?
48+
49+
If you are working with React Native version 60 (or older) you can install the previous release of DevTools from NPM:
50+
51+
```shell
52+
npm install --dev react-devtools@^3
53+
```
54+
55+
For older versions of React DOM (v0.14 or earlier) you will need to build the extension from source:
56+
57+
```shell
58+
# Checkout the extension source
59+
git clone https://github.com/facebook/react-devtools
60+
61+
cd react-devtools
62+
63+
# Install dependencies and build the unpacked extension
64+
yarn install
65+
yarn build:extension
66+
67+
# Follow the on-screen instructions to complete installation
68+
```
69+
70+
## Thank you!
71+
72+
We'd like to thank everyone who tested the early release of DevTools version 4.
73+
Your feedback helped improve this initial release significantly.
74+
75+
We still have many exciting features planned and feedback is always welcome!
76+
Please feel free to open a [GitHub issue](https://github.com/facebook/react/issues/new?labels=Component:%20Developer%20Tools) or tag [@reactjs on Twitter](https://twitter.com/reactjs).

content/community/articles.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ permalink: community/articles.html
1313
- [Timeline for Learning React](https://daveceddia.com/timeline-for-learning-react/) - Dave Ceddia's recommended timeline for learning React and the React ecosystem.
1414
- [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.
1515
- [Visual Guide to State in React](https://daveceddia.com/visual-guide-to-state-in-react/) - Dave Ceddia's visual guide to React state.
16-
- [The Hands-On Guide to Learning React Hooks](https://www.telerik.com/kendo-react-ui/react-hooks-guide/)
16+
- [The Hands-On Guide to Learning React Hooks](https://www.telerik.com/kendo-react-ui/react-hooks-guide/) - Eric Bishard's step-by-step guide to learning React Hooks.

content/community/conferences.md

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ May 4-6, 2020. Atlanta, GA, USA.
8282

8383
[Website](https://renderatl.com)
8484

85+
### React Next 2020 {#react-next-2020}
86+
June 15, 2020. Tel Aviv, Israel.
87+
88+
[Website](https://react-next.com/) - [Twitter](https://twitter.com/reactnext) - [Facebook](https://www.facebook.com/ReactNext2016/)
89+
90+
8591
## Past Conferences {#past-conferences}
8692

8793
### React.js Conf 2015 {#reactjs-conf-2015}

content/community/meetups.md

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
6969

7070
## India {#india}
7171
* [Bangalore](https://www.meetup.com/ReactJS-Bangalore/)
72+
* [Chandigarh](https://www.meetup.com/Chandigarh-React-Developers/)
7273
* [Chennai](https://www.meetup.com/React-Chennai/)
7374
* [Delhi NCR](https://www.meetup.com/React-Delhi-NCR/)
7475
* [Jaipur](https://www.meetup.com/JaipurJS-Developer-Meetup/)
@@ -79,6 +80,9 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
7980
## Israel {#israel}
8081
* [Tel Aviv](https://www.meetup.com/ReactJS-Israel/)
8182

83+
## Malaysia {#malaysia}
84+
* [Penang](https://www.facebook.com/groups/reactpenang/)
85+
8286
## Netherlands {#netherlands}
8387
* [Amsterdam](https://www.meetup.com/React-Amsterdam/)
8488

content/docs/addons-test-utils.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ it('can render and update a counter', () => {
124124

125125
- DOM イベントのディスパッチは、DOM コンテナが `document` に追加されたときだけ動作することを忘れないでください。[React Testing Library](https://testing-library.com/react) のようなヘルパーを使えばボイラープレートのコードを減らせます。
126126

127-
- [`recipes`](/docs/recipes.html) ドキュメントには `act()` がどのように動作するのかについて例や使用法を交えた詳しい解説があります。
127+
- [`recipes`](/docs/testing-recipes.html) ドキュメントには `act()` がどのように動作するのかについて例や使用法を交えた詳しい解説があります。
128128

129129
* * *
130130

content/docs/hooks-faq.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ prev: hooks-reference.html
6464
React バージョン 16.8.0 より、以下においてフックの安定版の実装が含まれています。
6565

6666
* React DOM
67+
* React Native
6768
* React DOM Server
6869
* React Test Renderer
6970
* React Shallow Renderer
7071

7172
**フックを利用するには、すべての React のパッケージが 16.8.0 以上である必要があります**。例えば React DOM の更新を忘れた場合、フックは動作しません。
7273

73-
React Native はバージョン 0.59 以降でフックをサポートします。
74+
React Native [バージョン 0.59](https://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059) 以降でフックをサポートします。
7475

7576
### クラスコンポーネントを全部書き換える必要があるのですか? {#do-i-need-to-rewrite-all-my-class-components}
7677

content/docs/hooks-intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function Example() {
3131

3232
> 補足
3333
>
34-
> React 16.8.0 がフックをサポートする最初のバージョンです。アップグレードの際は、React DOM を含むすべてのパッケージの更新を忘れないようにしてください。React Native は次の安定リリースでフックをサポートします
34+
> React 16.8.0 がフックをサポートする最初のバージョンです。アップグレードの際は、React DOM を含むすべてのパッケージの更新を忘れないようにしてください。React Native [React Native 0.59 リリース](https://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059)以降でフックをサポートします
3535
3636
## ビデオによる紹介 {#video-introduction}
3737

content/docs/optimizing-performance.md

+1-51
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,6 @@ React はレンダーされた UI の内部表現を構築し、維持します
211211

212212
コンポーネントの props や state が変更された場合、React は新しく返された要素と以前にレンダーされたものとを比較することで、実際の DOM の更新が必要かを判断します。それらが等しくない場合、React は DOM を更新します。
213213

214-
以下の React DevTools を使用することで、仮想 DOM のこれらの再レンダーを視覚化できるようになりました。
215-
216-
- [Chrome ブラウザ拡張](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
217-
- [Firefox ブラウザ拡張](https://addons.mozilla.org/en-GB/firefox/addon/react-devtools/)
218-
- [スタンドアロン Node パッケージ](https://www.npmjs.com/package/react-devtools)
219-
220-
開発者コンソールの **React** タブで **Highlight Updates** オプションを選択します:
221-
222-
<center><img src="../images/blog/devtools-highlight-updates.png" style="max-width:100%; margin-top:10px;" alt="How to enable highlight updates" /></center>
223-
224-
ページを操作すると、再レンダーされたコンポーネントの周囲に色付きの枠線が一定時間表示されます。これにより、不要な再レンダーを見つけることができます。React DevTools のこの機能の詳細については、[Ben Edelstein](https://blog.logrocket.com/@edelstein) による[ブログ投稿](https://blog.logrocket.com/make-react-fast-again-part-3-highlighting-component-updates-6119e45e6833)から学ぶことができます。
225-
226-
以下の例を考えてみましょう。
227-
228-
<center><img src="../images/blog/highlight-updates-example.gif" style="max-width:100%; margin-top:20px;" alt="React DevTools Highlight Updates example" /></center>
229-
230-
2 つ目の TODO 項目を入力しているとき、1 つ目の TODO 項目もキーストロークの度に画面上で点滅することに注意してください。これは、入力によって React が一緒に再レンダーしていることを意味します。これは「無駄な」レンダーと呼ばれることがあります。最初の TODO 項目の内容は変更されていないので、再レンダーの必要がないことを我々は知っていますが、React はそれを知りません。
231-
232214
React は変更された DOM ノードだけを更新するとはいえ、再レンダーには時間がかかります。多少の時間がかかっても多くの場合は問題にはなりませんが、遅延が目立つ場合、再レンダープロセスが開始される前にトリガーされるライフサイクル関数 `shouldComponentUpdate` をオーバーライド定義することで、スピードを抜本的に向上できます。この関数のデフォルトの実装は `true` を返し、React に更新処理をそのまま実行させます:
233215

234216
```javascript
@@ -399,36 +381,4 @@ function updateColorMap(colormap) {
399381

400382
Create React App を使用しているなら、`Object.assign` およびオブジェクトのスプレッド構文の両方がデフォルトで利用できます。
401383

402-
## 不変(イミュータブル)なデータ構造の使用 {#using-immutable-data-structures}
403-
404-
[Immutable.js](https://github.com/facebook/immutable-js) はこの問題を解決する別の方法であり、構造の共有を元にした、不変で永続的なデータのコレクションを提供します。
405-
406-
* *不変性*: 一度作成されたら、データのコレクションはその後で変更されることはない。
407-
* *永続性*: 既存のコレクションから、あるいはそれに set などの変更操作を行うことで新しいデータのコレクションを作成することができる。元のコレクションは新しいデータのコレクションが作成された後も有効である。
408-
* *構造の共有*: 新しいデータのコレクションは、元のコレクションが含む同じ構造を可能な限り共有して作られるので、データのコピー量が減りパフォーマンスが向上する。
409-
410-
不変性により、変化を検出するためのコストが下がります。変化したデータは常に新しいオブジェクトになるので、オブジェクトの参照が違うかをどうかをチェックすればよくなるのです。例えば、以下の通常の JavaScript コードにおいて、
411-
412-
```javascript
413-
const x = { foo: 'bar' };
414-
const y = x;
415-
y.foo = 'baz';
416-
x === y; // true
417-
```
418-
419-
ここで `y` は編集されたにも関わらず、`x` と同じオブジェクトを参照しているため、上記の比較は `true` を返します。これと似たコードを immutable.js で書くとこうなります:
420-
421-
```javascript
422-
const SomeRecord = Immutable.Record({ foo: null });
423-
const x = new SomeRecord({ foo: 'bar' });
424-
const y = x.set('foo', 'baz');
425-
const z = x.set('foo', 'bar');
426-
x === y; // false
427-
x === z; // true
428-
```
429-
430-
この場合、`x` を変更すると新しい参照が返されるので、参照の比較 `(x === y)` をするだけで、`y` に保存されている新しい値は `x` に保存されていた値とは違うことが確認できます。
431-
432-
不変データの使用を助けてくる他のライブラリに [Immer](https://github.com/mweststrate/immer)[immutability-helper](https://github.com/kolodny/immutability-helper)[seamless-immutable](https://github.com/rtfeldman/seamless-immutable) があります。
433-
434-
不変データ構造はオブジェクトの変化の検出を容易にします。まさにそれが `shouldComponentUpdate` の実装に必要なことのすべてです。これによってパフォーマンスを大幅に向上できる場合があります。
384+
深くネストされたオブジェクトを扱っている場合、ミューテートを行わない形式で更新することが複雑に感じることがあります。このような問題がある場合は [Immer](https://github.com/mweststrate/immer)[immutability-helper](https://github.com/kolodny/immutability-helper) を試してみてください。これらのライブラリはミューテートを行わないことによる利点を損なわずに、読みやすいコードを書くのに役立ちます。

content/docs/reference-profiler.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ render(
4444
<Profiler id="Main" onRender={callback}>
4545
<Main {...props} />
4646
</Profiler>
47-
</App>
47+
</App>
4848
);
4949
```
5050

content/docs/reference-test-renderer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']);
103103
TestRenderer.create(element, options);
104104
```
105105

106-
渡された React 要素から `TestRenderer` インスタンスを作成します。実際の DOM は使用しませんが、コンポーネントを完全な形でメモリにレンダーするので、アサーションを行うことができます。返されたインスタンスは、次のメソッドとプロパティを持ちます
106+
渡された React 要素から `TestRenderer` インスタンスを作成します。実際の DOM は使用しませんが、コンポーネントを完全な形でメモリにレンダーするので、アサーションを行うことができます。返り値は [TestRenderer のインスタンス](#testrenderer-instance)となります
107107

108108
### `TestRenderer.act()` {#testrendereract}
109109

content/docs/static-type-checking.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ Flow は JavaScript 言語を拡張し、型定義のための特殊な記法を
8888
yarn を使っている場合:
8989

9090
```bash
91-
yarn add --dev babel-preset-flow
91+
yarn add --dev @babel/preset-flow
9292
```
9393

9494
npm を使っている場合:
9595

9696
```bash
97-
npm install --save-dev babel-preset-flow
97+
npm install --save-dev @babel/preset-flow
9898
```
9999

100100
そして、`flow` のプリセットを [Babel の設定ファイル](https://babeljs.io/docs/usage/babelrc/) に追加してください。例えば、Babel の設定を `.babelrc` ファイルで行っている場合は以下のようになります。
101101

102102
```js{3}
103103
{
104104
"presets": [
105-
"flow",
105+
"@babel/preset-flow",
106106
"react"
107107
]
108108
}
Loading
124 KB
Loading

src/components/CodeEditor/CodeEditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class CodeEditor extends Component {
270270

271271
_updateState(code, showJSX = true) {
272272
try {
273-
let newState = {
273+
const newState = {
274274
compiled: compileES5(code),
275275
error: null,
276276
};

0 commit comments

Comments
 (0)