Skip to content

Commit 03180af

Browse files
#4 react-v16.13.0.md add japanese transration
1 parent f8766bb commit 03180af

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

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

Lines changed: 38 additions & 33 deletions
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

1010
## New Warnings {#new-warnings}
1111

12-
### Warnings for some updates during render {#warnings-for-some-updates-during-render}
12+
### Warnings for some updates during render {#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

2424
### Warnings for conflicting style rules {#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プロパティのlonghandとshorthandを含む `style` を動的に適用する場合、特定の更新の組み合わせにより、スタイリングの一貫性が失われることがあります。例えば、以下のようになります。
2727

2828
```js
2929
<div style={toggle ?
@@ -34,23 +34,26 @@ 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` の間で交互に変更されます。
38+
3839

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.
40+
**Reactは、スタイルルールの競合を検出し、警告をログに記録するようになりました。**
41+
警告が検出されたソースコードを修正するには、同じCSSプロパティのshortandとlonghandのバージョンを`style`プロップに混在させないようにしてください。
4042

4143
### Warnings for some deprecated string refs {#warnings-for-some-deprecated-string-refs}
4244

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:
45+
[String Refs は古いバージョンのAPI](/docs/refs-and-the-dom.html#legacy-api-string-refs)は開発者に気に入れられておらず、将来的には非推奨になりそうです。
4446

4547
```js
4648
<Button ref="myRef" />
4749
```
4850

49-
(Don't confuse String Refs with refs in general, which **remain fully supported**.)
51+
(String Refs と一般的な refs を混同しないでください。)
52+
5053

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.
54+
将来的には、String Refsからの移行を自動化するスクリプト(a "codemod")を提供する予定です。しかし、まれに自動移行できないケースがあります。このリリースでは、非推奨となるケースに先立ち、**そのようなケースにのみ**警告を追加しています。
5255

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

5558
```jsx
5659
class ClassWithRenderProp extends React.Component {
@@ -73,9 +76,10 @@ class ClassParent extends React.Component {
7376
}
7477
```
7578

76-
Code like this often indicates bugs. (You might expect the ref to be available on `ClassParent`, but instead it gets placed on `ClassWithRenderProp`).
7779

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:
80+
このようなコードはしばしばバグを示します。(参照は `ClassParent` で利用できると思っていたかもしれませんが、代わりに `ClassWithRenderProp` に置かれてしまいます)。
81+
82+
**このようなコードを持っていない可能性が高いです**。もし持っていて、それが意図的なものであれば、それを [`React.createRef()`](/docs/refs-and-the-dom.html#creating-refs) の代わりに:
7983

8084
```jsx
8185
class ClassWithRenderProp extends React.Component {
@@ -107,76 +111,77 @@ class ClassParent extends React.Component {
107111
108112
### Deprecating `React.createFactory` {#deprecating-reactcreatefactory}
109113

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.
114+
[`React.createFactory`](/docs/react-api.html#createfactory) はReact要素を作成するための旧版のルパーです。このリリースでは、メソッドに非推奨の警告が追加されています。これは将来のメジャーバージョンで削除される予定です。
111115

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:
116+
`React.createFactory` の使用法を通常の JSX で置き換えてください。代わりに、この一行ヘルパーをコピー&ペーストするか、ライブラリとして公開することもできます。
113117

114118
```jsx
115119
let createFactory = type => React.createElement.bind(null, type);
116120
```
117121

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

120124
### Deprecating `ReactDOM.unstable_createPortal` in favor of `ReactDOM.createPortal` {#deprecating-reactdomunstable_createportal-in-favor-of-reactdomcreateportal}
121125

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

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.
128+
しかし、`unstable_createPortal`を採用している少数のライブラリが動作するように、`unstable_createPortal`をサポートされたエイリアスとして残していました。現在、この不安定なエイリアスは非推奨となっています。`unstable_createPortal` の代わりに `createPortal` を直接使ってください。これは全く同じシグネチャを持っています。
125129

126130
## Other Improvements {#other-improvements}
127131

128132
### Component stacks in hydration warnings {#component-stacks-in-hydration-warnings}
129133

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:
134+
React は開発警告にコンポーネントスタックを追加し、開発者がバグを分離してプログラムをデバッグできるようにします。今回のリリースでは、以前はなかった多くの開発警告にコンポーネントスタックが追加されました。例として、以前のバージョンにあったこのハイドレーション警告を考えてみましょう。
131135

132136
![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)
133137

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:
138+
コードのエラーを指摘していますが、どこにエラーが存在しているのか、次に何をすればいいのかが明確ではありません。このリリースでは、この警告にコンポーネントスタックが追加され、以下のようになりました。
135139

136140
![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)
137141

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

140144
### Notable bugfixes {#notable-bugfixes}
141145

142-
This release contains a few other notable improvements:
146+
このリリースには、他にもいくつかの注目すべき改善点が含まれています。
147+
148+
- 厳密な開発モードでは、React はライフサイクルメソッドを2回呼び出し、不要な副作用の可能性を洗い出すようにしています。このリリースでは、その動作を `shouldComponentUpdate` に追加しています。これは、`shouldComponentUpdate`に副作用がない限り、ほとんどのコードには影響しないはずです。これを修正するには、副作用のあるコードを `componentDidUpdate` に移動してください。
143149

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`.
150+
- 厳密な開発モードでは、レガシーコンテキストAPIの使用に関する警告には、警告のトリガーとなったコンポーネントのスタックが含まれていませんでした。このリリースでは、不足していたスタックが警告に追加されます。
145151

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.
152+
- 無効な `<button>` 要素に対して `onMouseEnter` がトリガーされないようになりました。
147153

148-
- `onMouseEnter` now doesn't trigger on disabled `<button>` elements.
154+
- ReactDOM は v16 を公開して以来、`version` のエクスポートがありませんでした。このリリースではそれが追加されました。アプリケーションロジックでの使用はお勧めしませんが、同じページ上のReactDOMのバージョンの不一致や複数のバージョンの問題をデバッグする際に便利です。
149155

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.
156+
これらの問題やその他の問題を解決してくれた貢献者に感謝します。完全なchangelog [下記](#changelog)を参照してください。
151157

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).
153158

154159
## Installation {#installation}
155160

156161
### React {#react}
157162

158-
React v16.13.0 is available on the npm registry.
163+
React v16.13.0 はnpmで利用可能です。
159164

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

162167
```bash
163168
yarn add react@^16.13.0 react-dom@^16.13.0
164169
```
165170

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

168173
```bash
169174
npm install --save react@^16.13.0 react-dom@^16.13.0
170175
```
171176

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

174179
```html
175180
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
176181
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
177182
```
178183

179-
Refer to the documentation for [detailed installation instructions](/docs/installation.html).
184+
[詳細のスクリプト設置方法](/docs/installation.html)については、説明書を参照してください。
180185

181186
## Changelog {#changelog}
182187

0 commit comments

Comments
 (0)