Skip to content

Commit 3d48615

Browse files
Hayao0819smikitky
andauthoredJul 20, 2023
Translate "Hooks" index page (#618)
* Translate "Hooks" index page * Follow translation roles in "Hooks" page * Apply suggestions from code review Co-authored-by: Soichiro Miki <[email protected]> * Remove unneeded space --------- Co-authored-by: Soichiro Miki <[email protected]>
1 parent b68e540 commit 3d48615

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed
 

‎src/content/reference/react/index.md

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
title: "Built-in React Hooks"
2+
title: "組み込みの React フック"
33
---
44

55
<Intro>
66

7-
*Hooks* let you use different React features from your components. You can either use the built-in Hooks or combine them to build your own. This page lists all built-in Hooks in React.
7+
*フック*を用いると、コンポーネントから様々な React の機能を使えるようになります。組み込みのフックを使うこともできますし、組み合わせて自分だけのものを作ることもできます。このページでは、React に組み込まれた全てのフックを説明します。
88

99
</Intro>
1010

1111
---
1212

13-
## State Hooks {/*state-hooks*/}
13+
## state フック {/*state-hooks*/}
1414

15-
*State* lets a component ["remember" information like user input.](/learn/state-a-components-memory) For example, a form component can use state to store the input value, while an image gallery component can use state to store the selected image index.
15+
*state* を使うと、ユーザの入力などの情報を[コンポーネントに「記憶」](/learn/state-a-components-memory)させることができます。例えば、フォームコンポーネントは入力された文字を保持し、画像ギャラリのコンポーネントは選択された画像を保持できます。
1616

17-
To add state to a component, use one of these Hooks:
17+
コンポーネントに state を追加するには、次のフックのいずれかを使います:
1818

19-
* [`useState`](/reference/react/useState) declares a state variable that you can update directly.
20-
* [`useReducer`](/reference/react/useReducer) declares a state variable with the update logic inside a [reducer function.](/learn/extracting-state-logic-into-a-reducer)
19+
* [`useState`](/reference/react/useState) は直接的に更新できる state 変数を定義します。
20+
* [`useReducer`](/reference/react/useReducer) は、[リデューサ関数](/learn/extracting-state-logic-into-a-reducer)内に書いたロジックを用いて更新を行う state 変数を定義します。
2121

2222
```js
2323
function ImageGallery() {
@@ -27,11 +27,11 @@ function ImageGallery() {
2727
2828
---
2929
30-
## Context Hooks {/*context-hooks*/}
30+
## コンテクストフック {/*context-hooks*/}
3131
32-
*Context* lets a component [receive information from distant parents without passing it as props.](/learn/passing-props-to-a-component) For example, your app's top-level component can pass the current UI theme to all components below, no matter how deep.
32+
*コンテクスト*を用いると、コンポーネントは props を渡すことなく、[離れた親要素から情報を取得できるようになります](/learn/passing-props-to-a-component)。例えば、アプリの最上位のコンポーネントが、現在の UI テーマをコンポーネントの階層に関係なく全てのコンポーネントに渡すことができます。
3333
34-
* [`useContext`](/reference/react/useContext) reads and subscribes to a context.
34+
* [`useContext`](/reference/react/useContext) は、コンテクストの値を読み取り、変更を受け取れるようにします。
3535
3636
```js
3737
function Button() {
@@ -41,12 +41,12 @@ function Button() {
4141
4242
---
4343
44-
## Ref Hooks {/*ref-hooks*/}
44+
## ref フック {/*ref-hooks*/}
4545
46-
*Refs* let a component [hold some information that isn't used for rendering,](/learn/referencing-values-with-refs) like a DOM node or a timeout ID. Unlike with state, updating a ref does not re-render your component. Refs are an "escape hatch" from the React paradigm. They are useful when you need to work with non-React systems, such as the built-in browser APIs.
46+
*ref* を用いると、コンポーネントは DOM ノードやタイムアウト ID などの、[レンダーに用いない情報を保持](/learn/referencing-values-with-refs)することができます。state と違い、ref の値を更新してもコンポーネントは再レンダーされません。ref は、React パラダイムからの「避難ハッチ」です。これらは組み込みのブラウザ API などの、React 外のシステムを取り扱うときに役立ちます。
4747
48-
* [`useRef`](/reference/react/useRef) declares a ref. You can hold any value in it, but most often it's used to hold a DOM node.
49-
* [`useImperativeHandle`](/reference/react/useImperativeHandle) lets you customize the ref exposed by your component. This is rarely used.
48+
* [`useRef`](/reference/react/useRef) ref を宣言します。useRef にはどんな値でも格納できますが、多くの場合、DOM ノードを格納するために使われます。
49+
* [`useImperativeHandle`](/reference/react/useImperativeHandle) を用いると、コンポーネントが公開する ref をカスタマイズできます。これはほとんど用いられることはありません。
5050
5151
```js
5252
function Form() {
@@ -56,11 +56,11 @@ function Form() {
5656
5757
---
5858
59-
## Effect Hooks {/*effect-hooks*/}
59+
## エフェクトフック {/*effect-hooks*/}
6060
61-
*Effects* let a component [connect to and synchronize with external systems.](/learn/synchronizing-with-effects) This includes dealing with network, browser DOM, animations, widgets written using a different UI library, and other non-React code.
61+
*エフェクト*を使うことで、[コンポーネントを外部システムに接続し、同期させる](/learn/synchronizing-with-effects)ことができます。これには、ネットワーク、ブラウザの DOM、アニメーション、別の UI ライブラリを使って書かれたウィジェット、その他の非 React コードの処理が含まれます。
6262
63-
* [`useEffect`](/reference/react/useEffect) connects a component to an external system.
63+
* [`useEffect`](/reference/react/useEffect) は外部のシステムとコンポーネントを接続します。
6464
6565
```js
6666
function ChatRoom({ roomId }) {
@@ -72,23 +72,23 @@ function ChatRoom({ roomId }) {
7272
// ...
7373
```
7474
75-
Effects are an "escape hatch" from the React paradigm. Don't use Effects to orchestrate the data flow of your application. If you're not interacting with an external system, [you might not need an Effect.](/learn/you-might-not-need-an-effect)
75+
エフェクトは、React パラダイムからの「脱出ハッチ」です。エフェクトをアプリケーションのデータフローを調整するために使ってはいけません。外部のシステムとやりとりを行わないならば、[エフェクトは必要ないかもしれません](/learn/you-might-not-need-an-effect)
7676
77-
There are two rarely used variations of `useEffect` with differences in timing:
77+
`useEffect` には、実行タイミングが異なり、まれに使われることのある 2 つのバリエーションがあります:
7878
79-
* [`useLayoutEffect`](/reference/react/useLayoutEffect) fires before the browser repaints the screen. You can measure layout here.
80-
* [`useInsertionEffect`](/reference/react/useInsertionEffect) fires before React makes changes to the DOM. Libraries can insert dynamic CSS here.
79+
* [`useLayoutEffect`](/reference/react/useLayoutEffect) はブラウザが画面を再描画する前に発火します。このフックでレイアウトを測定できます。
80+
* [`useInsertionEffect`](/reference/react/useInsertionEffect) React DOM に変更を加える前に発火します。ライブラリは動的な CSS をこのフックで挿入できます。
8181
8282
---
8383
84-
## Performance Hooks {/*performance-hooks*/}
84+
## パフォーマンス関連フック {/*performance-hooks*/}
8585
86-
A common way to optimize re-rendering performance is to skip unnecessary work. For example, you can tell React to reuse a cached calculation or to skip a re-render if the data has not changed since the previous render.
86+
再レンダーのパフォーマンスを最適化するためのよくある方法は、不要な処理を減らすことです。例えばキャッシュ済みの計算結果を再利用したり、データの変更がない場合の再レンダーをスキップしたりするよう、React に伝えることができます。
8787
88-
To skip calculations and unnecessary re-rendering, use one of these Hooks:
88+
不要な計算やレンダーをスキップするためには、以下のフックを用いることができます:
8989
90-
- [`useMemo`](/reference/react/useMemo) lets you cache the result of an expensive calculation.
91-
- [`useCallback`](/reference/react/useCallback) lets you cache a function definition before passing it down to an optimized component.
90+
- [`useMemo`](/reference/react/useMemo) を用いると高負荷な計算の結果をキャッシュできます。
91+
- [`useCallback`](/reference/react/useCallback) を用いると、最適化済みのコンポーネントに渡すために関数定義をキャッシュしておくことができます。
9292
9393
```js
9494
function TodoList({ todos, tab, theme }) {
@@ -97,25 +97,25 @@ function TodoList({ todos, tab, theme }) {
9797
}
9898
```
9999
100-
Sometimes, you can't skip re-rendering because the screen actually needs to update. In that case, you can improve performance by separating blocking updates that must be synchronous (like typing into an input) from non-blocking updates which don't need to block the user interface (like updating a chart).
100+
画面の更新が実際にあるため、再レンダーをスキップできない場合もあるでしょう。その場合、同期的に行う必要があるユーザインターフェイスをブロックする更新(ユーザの文字入力など)を、ユーザインターフェイスをブロックする必要のないノンブロッキングな更新(図の更新など)から分離することで、パフォーマンスを向上することができます。
101101
102-
To prioritize rendering, use one of these Hooks:
102+
レンダーの優先度付けを行うために、以下のフックを用いることができます:
103103
104-
- [`useTransition`](/reference/react/useTransition) lets you mark a state transition as non-blocking and allow other updates to interrupt it.
105-
- [`useDeferredValue`](/reference/react/useDeferredValue) lets you defer updating a non-critical part of the UI and let other parts update first.
104+
- [`useTransition`](/reference/react/useTransition) を用いることで、state の遷移をノンブロッキングなものとしてマークし、他の更新による割り込みを許可します。
105+
- [`useDeferredValue`](/reference/react/useDeferredValue) を用いると、UI の重要でない部分の更新を遅延させて、他の部分を先に更新させることができます。
106106
107107
---
108108
109-
## Other Hooks {/*other-hooks*/}
109+
## その他のフック {/*other-hooks*/}
110110
111-
These Hooks are mostly useful to library authors and aren't commonly used in the application code.
111+
これらのフックはライブラリの開発者には有用ですが、アプリケーションコードでは通常は用いられることはありません。
112112
113-
- [`useDebugValue`](/reference/react/useDebugValue) lets you customize the label React DevTools displays for your custom Hook.
114-
- [`useId`](/reference/react/useId) lets a component associate a unique ID with itself. Typically used with accessibility APIs.
115-
- [`useSyncExternalStore`](/reference/react/useSyncExternalStore) lets a component subscribe to an external store.
113+
- [`useDebugValue`](/reference/react/useDebugValue) を用いると、React DevTools が表示するカスタムフックのラベルをカスタマイズできます。
114+
- [`useId`](/reference/react/useId) を用いると、コンポーネントにユニークな ID を関連付けることができます。通常はアクセシビリティ API とともに使用されます。
115+
- [`useSyncExternalStore`](/reference/react/useSyncExternalStore) を用いると、コンポーネントは外部のストアを参照できるようになります。
116116
117117
---
118118
119-
## Your own Hooks {/*your-own-hooks*/}
119+
## 独自のフック {/*your-own-hooks*/}
120120
121-
You can also [define your own custom Hooks](/learn/reusing-logic-with-custom-hooks#extracting-your-own-custom-hook-from-a-component) as JavaScript functions.
121+
JavaScript の関数として[独自のカスタムフックを定義](/learn/reusing-logic-with-custom-hooks#extracting-your-own-custom-hook-from-a-component)することもできます。

0 commit comments

Comments
 (0)
Please sign in to comment.