Skip to content

Commit 67546e4

Browse files
PeterTakahashismikitkykoba04
authored
#4 react-v16.13.0.md add japanese transration (#329)
* #4 react-v16.13.0.md add japanese transration * titleを日本語へ翻訳 * #329 @smikitkyさん指摘箇所の修正 * #329 warningを警告と翻訳 * #329 @smikitky さん追加修正箇所 * 行数をあわせる * Update content/blog/2020-02-26-react-v16.13.0.md Co-authored-by: Soichiro Miki <smiki-tky@umin.ac.jp> * #329 fix textlint warning * #329 補足の追記 * textlint 修正 * unwantedの訳の翻訳修正 Co-authored-by: Toru Kobayashi <koba0004@gmail.com> Co-authored-by: Soichiro Miki <smiki-tky@umin.ac.jp> Co-authored-by: Toru Kobayashi <koba0004@gmail.com>
1 parent 514d157 commit 67546e4

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

Diff for: content/blog/2020-02-26-react-v16.13.0.md

+46-46
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ redirect_from:
55
- "blog/2020/03/02/react-v16.13.0.html"
66
---
77

8-
Today we are releasing React 16.13.0. It contains bugfixes and new deprecation warnings to help prepare for a future major release.
8+
本日、React 16.13.0 をリリースします。このリリースには、バグ修正と、今後のメジャーリリースに備えるための新しい非推奨の警告が含まれています。
99

10-
## New Warnings {#new-warnings}
10+
## 新たな警告 {#new-warnings}
1111

12-
### Warnings for some updates during render {#warnings-for-some-updates-during-render}
12+
### レンダリング中のいくつかの更新に関する警告 {#warnings-for-some-updates-during-render}
1313

14-
A React component should not cause side effects in other components during rendering.
14+
React コンポーネントは、レンダー中に他のコンポーネントに副作用を起こしてはいけません。
1515

16-
It is supported to call `setState` during render, but [only for *the same component*](/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops). If you call `setState` during a render on a different component, you will now see a warning:
16+
レンダー中に `setState` を呼び出すことはサポートされていますが[*同じ*コンポーネントに対してのみ](/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops)可能です。別のコンポーネントのレンダー中に `setState` を呼び出すと、警告が表示されるようになりました。
1717

1818
```
1919
Warning: Cannot update a component from inside the function body of a different component.
2020
```
2121

22-
**This warning will help you find application bugs caused by unintentional state changes.** In the rare case that you intentionally want to change the state of another component as a result of rendering, you can wrap the `setState` call into `useEffect`.
22+
**この警告は、意図しない状態変更によって引き起こされるアプリケーションのバグを見つけるのに役立ちます。**レンダーの結果として他のコンポーネントの状態を意図的に変更したいという稀なケースでは、`setState` 呼び出しを `useEffect` にラップすることができます。
2323

24-
### Warnings for conflicting style rules {#warnings-for-conflicting-style-rules}
24+
### スタイルルールが矛盾している場合の警告 {#warnings-for-conflicting-style-rules}
2525

26-
When dynamically applying a `style` that contains longhand and shorthand versions of CSS properties, particular combinations of updates can cause inconsistent styling. For example:
26+
ある CSS プロパティの長い記法と短い記法を同時に含む `style` を動的に適用する場合、特定の更新の組み合わせにより、スタイリングの一貫性が失われることがあります。例えば、以下のようになります。
2727

2828
```js
2929
<div style={toggle ?
@@ -34,23 +34,23 @@ When dynamically applying a `style` that contains longhand and shorthand version
3434
</div>
3535
```
3636

37-
You might expect this `<div>` to always have a red background, no matter the value of `toggle`. However, on alternating the value of `toggle` between `true` and `false`, the background color start as `red`, then alternates between `transparent` and `blue`, [as you can see in this demo](https://codesandbox.io/s/suspicious-sunset-g3jub).
37+
この `<div>` `toggle` の値に関係なく常に背景色が赤になると思われるかもしれません。しかし、[このデモを見てわかるように](https://codesandbox.io/s/suspicious-sunset-g3jub)`toggle` の値を `true` `false` の間で切り替えると、背景色は `red` から始まり、その後 `transparent` `blue` の間で交互に切り替わります。
3838

39-
**React now detects conflicting style rules and logs a warning.** To fix the issue, don't mix shorthand and longhand versions of the same CSS property in the `style` prop.
39+
**React は、スタイルルールの競合を検出し、警告をログに記録するようになりました。**この問題を修正するには、同一の CSS プロパティの短い記法と長い記法のバージョンを `style` プロパティ内で混在させないようにしてください。
4040

41-
### Warnings for some deprecated string refs {#warnings-for-some-deprecated-string-refs}
41+
### 一部の非推奨 string ref に関する注意点 {#warnings-for-some-deprecated-string-refs}
4242

43-
[String Refs is an old legacy API](/docs/refs-and-the-dom.html#legacy-api-string-refs) which is discouraged and is going to be deprecated in the future:
43+
[String ref(文字列形式の ref)は古いレガシー API](/docs/refs-and-the-dom.html#legacy-api-string-refs) であり、既に勧められておらず、将来的に正式に非推奨となる予定です。
4444

4545
```js
4646
<Button ref="myRef" />
4747
```
4848

49-
(Don't confuse String Refs with refs in general, which **remain fully supported**.)
49+
String ref と異なり、一般的な ref 自体は**完全にサポートされ続けます**ので混同しないようにしてください)
5050

51-
In the future, we will provide an automated script (a "codemod") to migrate away from String Refs. However, some rare cases can't be migrated automatically. This release adds a new warning **only for those cases** in advance of the deprecation.
51+
将来的には、string ref からの移行を自動化するスクリプト ("codemod") を提供する予定です。しかし、まれに自動移行できないケースがあります。このリリースでは、非推奨化に先立ち、**そのようなケースにのみ**警告を追加しています。
5252

53-
For example, it will fire if you use String Refs together with the Render Prop pattern:
53+
例えば、レンダープロップパターンと一緒に string ref を使用した場合に発生します。
5454

5555
```jsx
5656
class ClassWithRenderProp extends React.Component {
@@ -73,9 +73,9 @@ class ClassParent extends React.Component {
7373
}
7474
```
7575

76-
Code like this often indicates bugs. (You might expect the ref to be available on `ClassParent`, but instead it gets placed on `ClassWithRenderProp`).
76+
このようなコードはしばしばバグを示します。(ref `ClassParent` で利用できると思われるかもしれませんが、代わりに `ClassWithRenderProp` に置かれてしまいます)。
7777

78-
**You most likely don't have code like this**. If you do and it is intentional, convert it to [`React.createRef()`](/docs/refs-and-the-dom.html#creating-refs) instead:
78+
**このようなコードはお持ちでない可能性が高いでしょう**。もしそのようなコードがあって、それが意図的なものであれば、代わりに [`React.createRef()`](/docs/refs-and-the-dom.html#creating-refs) を使うよう変更してください:
7979

8080
```jsx
8181
class ClassWithRenderProp extends React.Component {
@@ -99,86 +99,86 @@ class ClassParent extends React.Component {
9999
}
100100
```
101101

102-
> Note
102+
> 補足
103103
>
104-
> To see this warning, you need to have the [babel-plugin-transform-react-jsx-self](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx-self) installed in your Babel plugins. It must _only_ be enabled in development mode.
104+
> この警告を見るためには、Babel プラグインとして [babel-plugin-transform-react-jsx-self](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx-self) がインストールされている必要があります。これは開発モードで*のみ*有効にする必要があります。
105105
>
106-
> If you use Create React App or have the "react" preset with Babel 7+, you already have this plugin installed by default.
106+
> Create React App を使っているか、Babel 7 以降で "react" プリセットを使っている場合、既にデフォルトでこのプラグインはインストールされています。
107107
108-
### Deprecating `React.createFactory` {#deprecating-reactcreatefactory}
108+
### `React.createFactory` の非推奨化 {#deprecating-reactcreatefactory}
109109

110-
[`React.createFactory`](/docs/react-api.html#createfactory) is a legacy helper for creating React elements. This release adds a deprecation warning to the method. It will be removed in a future major version.
110+
[`React.createFactory`](/docs/react-api.html#createfactory) React 要素を作成するためのレガシーのヘルパです。このリリースでは、このメソッドに非推奨の警告が追加されています。これは将来のメジャーバージョンで削除される予定です。
111111

112-
Replace usages of `React.createFactory` with regular JSX. Alternately, you can copy and paste this one-line helper or publish it as a library:
112+
`React.createFactory` の使用法を通常の JSX で置き換えてください。代わりに、この 1 行ヘルパをコピー&ペーストするか、ライブラリとして公開することもできます。
113113

114114
```jsx
115115
let createFactory = type => React.createElement.bind(null, type);
116116
```
117117

118-
It does exactly the same thing.
118+
全く同じことをしています。
119119

120-
### Deprecating `ReactDOM.unstable_createPortal` in favor of `ReactDOM.createPortal` {#deprecating-reactdomunstable_createportal-in-favor-of-reactdomcreateportal}
120+
### `ReactDOM.unstable_createPortal` の非推奨化、`ReactDOM.createPortal` に変更を {#deprecating-reactdomunstable_createportal-in-favor-of-reactdomcreateportal}
121121

122-
When React 16 was released, `createPortal` became an officially supported API.
122+
React 16 がリリースされたとき、`createPortal` は公式にサポートされる API になりました。
123123

124-
However, we kept `unstable_createPortal` as a supported alias to keep the few libraries that adopted it working. We are now deprecating the unstable alias. Use `createPortal` directly instead of `unstable_createPortal`. It has exactly the same signature.
124+
しかし、`unstable_createPortal` を採用している少数のライブラリが動作するように、`unstable_createPortal` をサポートされたエイリアスとして残していました。今後この不安定なエイリアスは非推奨とします。`unstable_createPortal` の代わりに `createPortal` を直接使ってください。これは全く同じシグネチャを持っています。
125125

126-
## Other Improvements {#other-improvements}
126+
## その他の改良事項 {#other-improvements}
127127

128-
### Component stacks in hydration warnings {#component-stacks-in-hydration-warnings}
128+
### hydration の警告におけるコンポーネントスタック {#component-stacks-in-hydration-warnings}
129129

130-
React adds component stacks to its development warnings, enabling developers to isolate bugs and debug their programs. This release adds component stacks to a number of development warnings that didn't previously have them. As an example, consider this hydration warning from the previous versions:
130+
React は開発者向け警告にコンポーネントスタックを追加し、開発者がバグを特定してプログラムをデバッグできるようにしています。今回のリリースでは、以前はコンポーネントスタックが存在しなかった多くの開発者向け警告に、それが追加されました。例として、以前のバージョンにあったこのハイドレーション警告を考えてみましょう。
131131

132132
![A screenshot of the console warning, simply stating the nature of the hydration mismatch: "Warning: Expected server HTML to contain a matching div in div."](../images/blog/react-v16.13.0/hydration-warning-before.png)
133133

134-
While it's pointing out an error with the code, it's not clear where the error exists, and what to do next. This release adds a component stack to this warning, which makes it look like this:
134+
コードとともにエラーを指摘していますが、どこにエラーが存在しているのか、次に何をすればいいのかが明確ではありません。このリリースでは、この警告にコンポーネントスタックが追加され、以下のようになりました。
135135

136136
![A screenshot of the console warning, stating the nature of the hydration mismatch, but also including a component stack : "Warning: Expected server HTML to contain a matching div in div, in div (at pages/index.js:4)..."](../images/blog/react-v16.13.0/hydration-warning-after.png)
137137

138-
This makes it clear where the problem is, and lets you locate and fix the bug faster.
138+
これにより、問題がどこにあるのかが明確になり、より早くバグの場所を特定して修正することができます。
139139

140-
### Notable bugfixes {#notable-bugfixes}
140+
### 注目すべきバグ修正 {#notable-bugfixes}
141141

142-
This release contains a few other notable improvements:
142+
このリリースには、他にもいくつかの注目すべき改善点が含まれています。
143143

144-
- In Strict Development Mode, React calls lifecycle methods twice to flush out any possible unwanted side effects. This release adds that behaviour to `shouldComponentUpdate`. This shouldn't affect most code, unless you have side effects in `shouldComponentUpdate`. To fix this, move the code with side effects into `componentDidUpdate`.
144+
- Strict 開発モードでは、React はライフサイクルメソッドを 2 回呼び出し、好ましくない副作用の可能性を洗い出すようにしています。このリリースでは、その動作を `shouldComponentUpdate` に追加しています。これは、`shouldComponentUpdate` に副作用がない限り、ほとんどのコードには影響しないはずです。これを修正するには、副作用のあるコードを `componentDidUpdate` に移動してください。
145145

146-
- In Strict Development Mode, the warnings for usage of the legacy context API didn't include the stack for the component that triggered the warning. This release adds the missing stack to the warning.
146+
- Strict 開発モードでは、レガシーコンテクスト API の使用に関する警告には、警告のトリガとなったコンポーネントのスタックが含まれていませんでした。このリリースでは、欠けていたスタックが警告に追加されます。
147147

148-
- `onMouseEnter` now doesn't trigger on disabled `<button>` elements.
148+
- 無効な(disabled の)`<button>` 要素に対して `onMouseEnter` がトリガされないようになりました。
149149

150-
- ReactDOM was missing a `version` export since we published v16. This release adds it back. We don't recommend using it in your application logic, but it's useful when debugging issues with mismatching / multiple versions of ReactDOM on the same page.
150+
- ReactDOM は v16 を公開して以来、`version` のエクスポートがありませんでした。このリリースではそれが改めて追加されました。アプリケーションロジックでの使用はお勧めしませんが、同じページ上の ReactDOM のバージョン不一致や複数バージョンに関わる問題をデバッグする際に便利です。
151151

152-
We’re thankful to all the contributors who helped surface and fix these and other issues. You can find the full changelog [below](#changelog).
152+
これらの問題やその他の問題を解決してくれた貢献者に感謝します。完全な changelog [下記](#changelog)を参照してください。
153153

154-
## Installation {#installation}
154+
## インストール {#installation}
155155

156156
### React {#react}
157157

158-
React v16.13.0 is available on the npm registry.
158+
React v16.13.0 npm レジストリで利用可能です。
159159

160-
To install React 16 with Yarn, run:
160+
Yarn で React 16 をインストールするには、下記を実行します:
161161

162162
```bash
163163
yarn add react@^16.13.0 react-dom@^16.13.0
164164
```
165165

166-
To install React 16 with npm, run:
166+
npm で React 16 をインストールするには、下記を実行します:
167167

168168
```bash
169169
npm install --save react@^16.13.0 react-dom@^16.13.0
170170
```
171171

172-
We also provide UMD builds of React via a CDN:
172+
また、CDN 経由で React の UMD ビルドも提供しています:
173173

174174
```html
175175
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
176176
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
177177
```
178178

179-
Refer to the documentation for [detailed installation instructions](/docs/installation.html).
179+
[詳細なインストール方法](/docs/installation.html)については、ドキュメントを参照してください。
180180

181-
## Changelog {#changelog}
181+
## 変更履歴 {#changelog}
182182

183183
### React {#react}
184184

0 commit comments

Comments
 (0)