Skip to content

Commit 0c80970

Browse files
committed
Translate "Server Components"
1 parent ffdbdca commit 0c80970

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

src/content/reference/rsc/server-components.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ canary: true
55

66
<Intro>
77

8-
Server Components are a new type of Component that renders ahead of time, before bundling, in an environment separate from your client app or SSR server.
8+
サーバコンポーネントは新しいタイプのコンポーネントです。クライアントアプリケーションや SSR サーバとは別の環境で、バンドル前に事前にレンダーされます。
99

1010
</Intro>
1111

12-
This separate environment is the "server" in React Server Components. Server Components can run once at build time on your CI server, or they can be run for each request using a web server.
12+
React Server Components の "server" とはこの別の環境を指しています。サーバコンポーネントは、CI サーバでビルド時に一度だけ実行することも、ウェブサーバを使用してリクエストごとに実行することもできます。
1313

1414
<InlineToc />
1515

1616
<Note>
1717

18-
#### How do I build support for Server Components? {/*how-do-i-build-support-for-server-components*/}
18+
#### サーバコンポーネントのサポートを追加する方法 {/*how-do-i-build-support-for-server-components*/}
1919

20-
While React Server Components in React 19 are stable and will not break between major versions, the underlying APIs used to implement a React Server Components bundler or framework do not follow semver and may break between minors in React 19.x.
20+
React 19 React Server Components は安定しており、マイナーバージョン間での破壊的変更はありませんが、サーバコンポーネントのバンドラやフレームワークを実装するために使用される基盤となる API は semver に従いません。React 19.x のマイナーバージョン間で変更が生じる可能性があります。
2121

22-
To support React Server Components as a bundler or framework, we recommend pinning to a specific React version, or using the Canary release. We will continue working with bundlers and frameworks to stabilize the APIs used to implement React Server Components in the future.
22+
React Server Components をバンドラやフレームワークでサポートする場合は、特定の React バージョンに固定するか、Canary リリースを使用することをお勧めします。React Server Components を実装するために使用される API を安定化させるため、今後もバンドラやフレームワークと連携を続けていきます。
2323

2424
</Note>
2525

26-
### Server Components without a Server {/*server-components-without-a-server*/}
27-
Server components can run at build time to read from the filesystem or fetch static content, so a web server is not required. For example, you may want to read static data from a content management system.
26+
### サーバを使用しないサーバコンポーネント {/*server-components-without-a-server*/}
27+
サーバコンポーネントはビルド時に実行でき、ファイルシステムから読み取ったり静的なコンテンツをフェッチしたりすることが可能です。したがってウェブサーバは必須ではありません。たとえばコンテンツ管理システムから静的データを読み取ることもできるでしょう。
2828

29-
Without Server Components, it's common to fetch static data on the client with an Effect:
29+
サーバコンポーネントがない場合、静的データは一般的に、クライアントでエフェクトを使って以下のようにフェッチします。
3030
```js
3131
// bundle.js
3232
import marked from 'marked'; // 35.9K (11.2K gzipped)
@@ -53,9 +53,9 @@ app.get(`/api/content/:page`, async (req, res) => {
5353
});
5454
```
5555

56-
This pattern means users need to download and parse an additional 75K (gzipped) of libraries, and wait for a second request to fetch the data after the page loads, just to render static content that will not change for the lifetime of the page.
56+
このパターンを使用すると、ページの表示期間中に変化しない静的なコンテンツをただレンダーするためだけに、ユーザは 75K(gzip 後)のライブラリを追加でダウンロードしてパースし、さらにページのロード後に別のリクエストがデータをフェッチしてくるのを待つ必要があることになります。
5757

58-
With Server Components, you can render these components once at build time:
58+
サーバコンポーネントを使用することで、これらのコンポーネントをビルド時に一度だけレンダーすることができます。
5959

6060
```js
6161
import marked from 'marked'; // Not included in bundle
@@ -69,34 +69,34 @@ async function Page({page}) {
6969
}
7070
```
7171

72-
The rendered output can then be server-side rendered (SSR) to HTML and uploaded to a CDN. When the app loads, the client will not see the original `Page` component, or the expensive libraries for rendering the markdown. The client will only see the rendered output:
72+
このレンダー出力は、サーバサイドレンダリング (SSR) HTML に変換され、CDN にアップロードできます。アプリがロードされる際、クライアントには元の `Page` コンポーネントの存在や、Markdown をレンダーするための高コストなライブラリの存在は見えません。レンダーされた出力が見えるだけです。
7373

7474
```js
7575
<div><!-- html for markdown --></div>
7676
```
7777

78-
This means the content is visible during first page load, and the bundle does not include the expensive libraries needed to render the static content.
78+
つまり、コンテンツは最初のページロード時にすぐ表示され、静的コンテンツをレンダーするためだけの高コストなライブラリをバンドルに含めなくともよくなるのです。
7979

8080
<Note>
8181

82-
You may notice that the Server Component above is an async function:
82+
上記のサーバコンポーネントが非同期関数であることに気付かれたかもしれません。
8383

8484
```js
8585
async function Page({page}) {
8686
//...
8787
}
8888
```
8989

90-
Async Components are a new feature of Server Components that allow you to `await` in render.
90+
非同期コンポーネントは、レンダー中に `await` できるというサーバコンポーネントの新機能です。
9191

92-
See [Async components with Server Components](#async-components-with-server-components) below.
92+
以下の[サーバコンポーネントでの非同期コンポーネント処理](#async-components-with-server-components)を参照してください。
9393

9494
</Note>
9595

96-
### Server Components with a Server {/*server-components-with-a-server*/}
97-
Server Components can also run on a web server during a request for a page, letting you access your data layer without having to build an API. They are rendered before your application is bundled, and can pass data and JSX as props to Client Components.
96+
### サーバを使用するサーバコンポーネント {/*server-components-with-a-server*/}
97+
サーバコンポーネントは、ページのリクエスト時にウェブサーバ内で実行することも可能であり、これにより API を構築することなくデータレイヤにアクセスできます。アプリケーションがバンドルされる前にレンダーされ、データと JSX をクライアントコンポーネントに props として渡すことができます。
9898

99-
Without Server Components, it's common to fetch dynamic data on the client in an Effect:
99+
サーバコンポーネントがない場合、一般的には以下のようにして、動的データをクライアントでエフェクトを使ってフェッチします。
100100

101101
```js
102102
// bundle.js
@@ -145,7 +145,7 @@ app.get(`/api/authors/:id`, async (req, res) => {
145145
});
146146
```
147147

148-
With Server Components, you can read the data and render it in the component:
148+
サーバコンポーネントを使用することで、コンポーネントの中で直接データを読み取ってレンダーできます。
149149

150150
```js
151151
import db from './database';
@@ -169,7 +169,7 @@ async function Author({id}) {
169169
}
170170
```
171171

172-
The bundler then combines the data, rendered Server Components and dynamic Client Components into a bundle. Optionally, that bundle can then be server-side rendered (SSR) to create the initial HTML for the page. When the page loads, the browser does not see the original `Note` and `Author` components; only the rendered output is sent to the client:
172+
この後バンドラは、データ、レンダー済みのサーバコンポーネント、および動的なクライアントコンポーネントをバンドルとして結合します。オプションとして、そのバンドルをサーバサイドレンダリング (SSR) して、ページの初期 HTML を作成できます。ページがロードされると、ブラウザには元の `Note` および `Author` コンポーネントの存在は見えません。クライアントにはレンダーされた出力のみが送信されます。
173173

174174
```js
175175
<div>
@@ -178,24 +178,24 @@ The bundler then combines the data, rendered Server Components and dynamic Clien
178178
</div>
179179
```
180180

181-
Server Components can be made dynamic by re-fetching them from a server, where they can access the data and render again. This new application architecture combines the simple “request/response” mental model of server-centric Multi-Page Apps with the seamless interactivity of client-centric Single-Page Apps, giving you the best of both worlds.
181+
サーバコンポーネントをサーバから再フェッチして、サーバではデータにアクセスして再レンダーする、という形で、サーバコンポーネントを動的に扱うことができます。この新しいアプリケーションアーキテクチャは、サーバセントリックなマルチページアプリにおける単純な「リクエスト/レスポンス」式のメンタルモデルと、クライアントセントリックなシングルページアプリケーションにおけるシームレスな操作性を組み合わせ、両方の利点を提供できるものです。
182182

183-
### Adding interactivity to Server Components {/*adding-interactivity-to-server-components*/}
183+
### サーバコンポーネントにインタラクティビティを追加する {/*adding-interactivity-to-server-components*/}
184184

185-
Server Components are not sent to the browser, so they cannot use interactive APIs like `useState`. To add interactivity to Server Components, you can compose them with Client Component using the `"use client"` directive.
185+
サーバコンポーネントはブラウザに送信されないため、`useState` のようなインタラクティブな API を使用できません。サーバコンポーネントにインタラクティビティを追加するには、`"use client"` ディレクティブを使用してクライアントコンポーネントと組み合わせます。
186186

187187
<Note>
188188

189-
#### There is no directive for Server Components. {/*there-is-no-directive-for-server-components*/}
189+
#### サーバコンポーネントのためのディレクティブはない {/*there-is-no-directive-for-server-components*/}
190190

191-
A common misunderstanding is that Server Components are denoted by `"use server"`, but there is no directive for Server Components. The `"use server"` directive is used for Server Actions.
191+
よくある誤解として、サーバコンポーネントを "use server" を用いて定義するものだと考えるというものがあります。サーバコンポーネントにはディレクティブがありません。"use server" ディレクティブは、サーバアクションのためのものです。
192192

193-
For more info, see the docs for [Directives](/reference/rsc/directives).
193+
詳細については、[ディレクティブ](/reference/rsc/directives) のドキュメントをご覧ください。
194194

195195
</Note>
196196

197197

198-
In the following example, the `Notes` Server Component imports an `Expandable` Client Component that uses state to toggle its `expanded` state:
198+
以下の例では、サーバコンポーネントである `Notes` がクライアントコンポーネントである `Expandable` をインポートしており、そこで state を使用して `expanded` をトグルしています。
199199
```js
200200
// Server Component
201201
import Expandable from './Expandable';
@@ -232,7 +232,7 @@ export default function Expandable({children}) {
232232
}
233233
```
234234

235-
This works by first rendering `Notes` as a Server Component, and then instructing the bundler to create a bundle for the Client Component `Expandable`. In the browser, the Client Components will see output of the Server Components passed as props:
235+
動作としては、最初に `Notes` がサーバコンポーネントとしてレンダーされ、次にバンドラに `Expandable` というクライアントコンポーネントのバンドルを作成するよう指示しています。ブラウザ側では、クライアントコンポーネントには props 経由で渡されるサーバコンポーネントの出力だけが見えることになります。
236236

237237
```js
238238
<head>
@@ -252,11 +252,11 @@ This works by first rendering `Notes` as a Server Component, and then instructin
252252
</body>
253253
```
254254

255-
### Async components with Server Components {/*async-components-with-server-components*/}
255+
### サーバコンポーネントでの非同期コンポーネント処理 {/*async-components-with-server-components*/}
256256

257-
Server Components introduce a new way to write Components using async/await. When you `await` in an async component, React will suspend and wait for the promise to resolve before resuming rendering. This works across server/client boundaries with streaming support for Suspense.
257+
サーバコンポーネントにより、async/await を使用してコンポーネントを書くという新しい手法が導入されます。非同期コンポーネント内で `await` すると、React はサスペンド (suspend) し、プロミスが解決 (resolve) されるのを待ってからレンダーを再開します。サスペンスのストリーミングサポートのおかげで、これはサーバ/クライアントの境界をまたいで機能します。
258258

259-
You can even create a promise on the server, and await it on the client:
259+
サーバでプロミスを作成し、それをクライアント側で待機することすら可能です。
260260

261261
```js
262262
// Server Component
@@ -292,6 +292,6 @@ function Comments({commentsPromise}) {
292292
}
293293
```
294294

295-
The `note` content is important data for the page to render, so we `await` it on the server. The comments are below the fold and lower-priority, so we start the promise on the server, and wait for it on the client with the `use` API. This will Suspend on the client, without blocking the `note` content from rendering.
295+
`note` の内容はページをレンダーするために重要なデータなので、サーバ側で `await` します。コメントは折りたたまれており優先度が低いため、サーバではプロミスを開始だけして、クライアントで `use` API を使用してそれを待機します。これによりクライアント側でサスペンドが起きますが、`note` の内容のレンダーをブロックしないで済みます。
296296

297-
Since async components are [not supported on the client](#why-cant-i-use-async-components-on-the-client), we await the promise with `use`.
297+
非同期コンポーネントは[クライアントではサポートされていない](#why-cant-i-use-async-components-on-the-client) ため、プロミスの待機は `use` を使用して行います。

src/sidebarReference.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@
360360
"sectionHeader": "React Server Components"
361361
},
362362
{
363-
"title": "Server Components",
363+
"title": "サーバコンポーネント",
364364
"path": "/reference/rsc/server-components",
365365
"canary": true
366366
},

0 commit comments

Comments
 (0)