Skip to content

Commit a67a2e7

Browse files
authored
Merge pull request #663 from reactjs/tr/render
Translate "render"
2 parents 5df60d2 + 5a72747 commit a67a2e7

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

Diff for: src/content/reference/react-dom/render.md

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
title: render
2+
title: レンダー
33
---
44

55
<Deprecated>
66

7-
This API will be removed in a future major version of React.
7+
この API は、今後のメジャーバージョンの React で削除される予定です。
88

9-
In React 18, `render` was replaced by [`createRoot`.](/reference/react-dom/client/createRoot) Using `render` in React 18 will warn that your app will behave as if it’s running React 17. Learn more [here.](/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis)
9+
React 18 では、`render` [`createRoot`](/reference/react-dom/client/createRoot) に置き換えられました。React 18 `render` を使用すると、アプリは React 17 を実行しているかのような振る舞いになるとの警告が表示されます。詳細は[こちらをご覧ください。](/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis)
1010

1111
</Deprecated>
1212

1313
<Intro>
1414

15-
`render` renders a piece of [JSX](/learn/writing-markup-with-jsx) ("React node") into a browser DOM node.
15+
`render` は、ブラウザの DOM ノードに [JSX](/learn/writing-markup-with-jsx)"React ノード")をレンダーします。
1616

1717
```js
1818
render(reactNode, domNode, callback?)
@@ -24,11 +24,11 @@ render(reactNode, domNode, callback?)
2424
2525
---
2626
27-
## Reference {/*reference*/}
27+
## リファレンス {/*reference*/}
2828
2929
### `render(reactNode, domNode, callback?)` {/*render*/}
3030
31-
Call `render` to display a React component inside a browser DOM element.
31+
`render` を呼び出して、ブラウザの DOM 要素に React コンポーネントを表示します。
3232
3333
```js
3434
import { render } from 'react-dom';
@@ -37,40 +37,40 @@ const domNode = document.getElementById('root');
3737
render(<App />, domNode);
3838
```
3939
40-
React will display `<App />` in the `domNode`, and take over managing the DOM inside it.
40+
React `domNode` 内に `<App />` を表示し、その内部の DOM の管理を行います。
4141
42-
An app fully built with React will usually only have one `render` call with its root component. A page that uses "sprinkles" of React for parts of the page may have as many `render` calls as needed.
42+
React で完全に構築されたアプリには、ルートコンポーネントを引数にした `render` 呼び出しが通常 1 つのみ存在します。ページ内に React を「散りばめて」使用するページの場合は、必要なだけ `render` を呼び出すことができます。
4343
44-
[See more examples below.](#usage)
44+
[さらに例を見る](#usage)
4545
46-
#### Parameters {/*parameters*/}
46+
#### 引数 {/*parameters*/}
4747
48-
* `reactNode`: A *React node* that you want to display. This will usually be a piece of JSX like `<App />`, but you can also pass a React element constructed with [`createElement()`](/reference/react/createElement), a string, a number, `null`, or `undefined`.
48+
* `reactNode`: 表示したい *React ノード*。通常は `<App />` のような JSX ですが、[`createElement()`](/reference/react/createElement) で構築した React 要素や、文字列、数値、`null`、または `undefined` を渡すこともできます。
4949
50-
* `domNode`: A [DOM element.](https://developer.mozilla.org/en-US/docs/Web/API/Element) React will display the `reactNode` you pass inside this DOM element. From this moment, React will manage the DOM inside the `domNode` and update it when your React tree changes.
50+
* `domNode`: [DOM 要素](https://developer.mozilla.org/en-US/docs/Web/API/Element)React は、渡された `reactNode` をこの DOM 要素内に表示します。この瞬間から、React `domNode` 内の DOM を管理し、React ツリーが変更されたときにそれを更新するようになります。
5151
52-
* **optional** `callback`: A function. If passed, React will call it after your component is placed into the DOM.
52+
* **省略可能** `callback`: 関数。渡された場合、React はコンポーネントが DOM に配置された後にそれを呼び出します。
5353
5454
55-
#### Returns {/*returns*/}
55+
#### 返り値 {/*returns*/}
5656
57-
`render` usually returns `null`. However, if the `reactNode` you pass is a *class component*, then it will return an instance of that component.
57+
`render` は通常 `null` を返します。ただし、渡す `reactNode` が*クラスコンポーネント*の場合、そのコンポーネントのインスタンスを返します。
5858
59-
#### Caveats {/*caveats*/}
59+
#### 注意点 {/*caveats*/}
6060
61-
* In React 18, `render` was replaced by [`createRoot`.](/reference/react-dom/client/createRoot) Please use `createRoot` for React 18 and beyond.
61+
* React 18 では、`render` [`createRoot`](/reference/react-dom/client/createRoot) に置き換えられました。React 18 以降では `createRoot` を使用してください。
6262
63-
* The first time you call `render`, React will clear all the existing HTML content inside the `domNode` before rendering the React component into it. If your `domNode` contains HTML generated by React on the server or during the build, use [`hydrate()`](/reference/react-dom/hydrate) instead, which attaches the event handlers to the existing HTML.
63+
* `render` を初めて呼び出したとき、React は React ルート内の既存の HTML コンテンツをすべてクリアしてから、React コンポーネントをレンダーします。`domNode` がサーバ上であるいはビルド中に React によって生成された HTML を含んでいる場合は、代わりに既存の HTML にイベントハンドラをアタッチできる [`hydrate()`](/reference/react-dom/hydrate) を使用してください。
6464
65-
* If you call `render` on the same `domNode` more than once, React will update the DOM as necessary to reflect the latest JSX you passed. React will decide which parts of the DOM can be reused and which need to be recreated by ["matching it up"](/learn/preserving-and-resetting-state) with the previously rendered tree. Calling `render` on the same `domNode` again is similar to calling the [`set` function](/reference/react/useState#setstate) on the root component: React avoids unnecessary DOM updates.
65+
* 同じ `domNode` に対して `render` を複数回呼び出すと、React は最新の JSX を反映するために必要なだけの DOM の更新を行います。React は、渡された JSX を以前にレンダーしたツリーと[「マッチング」](/learn/preserving-and-resetting-state)して、DOM のどの部分が再利用でき、どの部分を再作成する必要があるのかを決定します。同じ `domNode` に対して複数回 `render` を呼び出すことは、ルートコンポーネントで [`set` 関数](/reference/react/useState#setstate)を呼び出すことに似ており、React は不必要な DOM 更新を回避します。
6666
67-
* If your app is fully built with React, you'll likely have only one `render` call in your app. (If you use a framework, it might do this call for you.) When you want to render a piece of JSX in a different part of the DOM tree that isn't a child of your component (for example, a modal or a tooltip), use [`createPortal`](/reference/react-dom/createPortal) instead of `render`.
67+
* アプリが完全に React で構築されている場合、アプリ内で `render` を呼び出すのは通常 1 回だけです。(フレームワークを使用している場合、この呼び出しはフレームワークが行うかもしれません。)DOM ツリー内の、コンポーネントの子ではない別の部分に JSX をレンダーしたい場合(例えばモーダルやツールチップ)、`createRoot` の代わりに [`createPortal`](/reference/react-dom/createPortal) を使用してください。
6868
6969
---
7070
71-
## Usage {/*usage*/}
71+
## 使用法 {/*usage*/}
7272
73-
Call `render` to display a <CodeStep step={1}>React component</CodeStep> inside a <CodeStep step={2}>browser DOM node</CodeStep>.
73+
`render` を呼び出して、<CodeStep step={1}>React コンポーネント</CodeStep><CodeStep step={2}>ブラウザの DOM ノード</CodeStep>内に表示します。
7474
7575
```js [[1, 4, "<App />"], [2, 4, "document.getElementById('root')"]]
7676
import { render } from 'react-dom';
@@ -79,9 +79,9 @@ import App from './App.js';
7979
render(<App />, document.getElementById('root'));
8080
```
8181
82-
### Rendering the root component {/*rendering-the-root-component*/}
82+
### ルートコンポーネントのレンダー {/*rendering-the-root-component*/}
8383
84-
In apps fully built with React, **you will usually only do this once at startup**--to render the "root" component.
84+
React で完全に構築されたアプリでは通常、"ルート" コンポーネントをレンダーするためにスタートアップ時に**これを一度だけ行います**。
8585
8686
<Sandpack>
8787
@@ -101,13 +101,13 @@ export default function App() {
101101
102102
</Sandpack>
103103
104-
Usually you shouldn't need to call `render` again or to call it in more places. From this point on, React will be managing the DOM of your application. To update the UI, your components will [use state.](/reference/react/useState)
104+
通常、`render` を再度呼び出したり複数の場所で呼び出したりする必要はありません。この時点から、React はアプリケーションの DOM を管理します。UI を更新するには、コンポーネントが [state を使用します](/reference/react/useState)
105105
106106
---
107107
108-
### Rendering multiple roots {/*rendering-multiple-roots*/}
108+
### 複数のルートのレンダー {/*rendering-multiple-roots*/}
109109
110-
If your page [isn't fully built with React](/learn/add-react-to-an-existing-project#using-react-for-a-part-of-your-existing-page), call `render` for each top-level piece of UI managed by React.
110+
ページが[完全には React で構築されていない](/learn/add-react-to-an-existing-project#using-react-for-a-part-of-your-existing-page)場合、React に管理させたいトップレベルの UI パーツに対してそれぞれ `render` を呼び出すことができます。
111111
112112
<Sandpack>
113113
@@ -177,13 +177,13 @@ nav ul li { display: inline-block; margin-right: 20px; }
177177
178178
</Sandpack>
179179
180-
You can destroy the rendered trees with [`unmountComponentAtNode()`.](/reference/react-dom/unmountComponentAtNode)
180+
レンダーされたツリーは [`unmountComponentAtNode()`](/reference/react-dom/unmountComponentAtNode) で破棄することができます。
181181
182182
---
183183
184-
### Updating the rendered tree {/*updating-the-rendered-tree*/}
184+
### レンダーされたツリーの更新 {/*updating-the-rendered-tree*/}
185185
186-
You can call `render` more than once on the same DOM node. As long as the component tree structure matches up with what was previously rendered, React will [preserve the state.](/learn/preserving-and-resetting-state) Notice how you can type in the input, which means that the updates from repeated `render` calls every second are not destructive:
186+
同じ DOM ノードに対して `render` を複数回呼び出すことができます。コンポーネントツリーの構造が以前にレンダーされたものと一致していれば、React は [state を保持します](/learn/preserving-and-resetting-state)。以下の例で入力フィールドにタイプできることに着目してください。つまり毎秒 `render` が繰り返し呼び出されていますが、更新により DOM が破壊されていないということです。
187187
188188
<Sandpack>
189189
@@ -215,4 +215,4 @@ export default function App({counter}) {
215215
216216
</Sandpack>
217217
218-
It is uncommon to call `render` multiple times. Usually, you'll [update state](/reference/react/useState) inside your components instead.
218+
`render` を複数回呼び出すことは滅多にありません。通常、代わりにコンポーネントで [state の更新](/reference/react/useState)を行います。

0 commit comments

Comments
 (0)