Skip to content

Commit baa6531

Browse files
authored
Merge pull request #774 from reactjs/tr/server-actions
Translate "Server Actions"
2 parents 4674ea3 + ea4c1f4 commit baa6531

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

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

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
---
2-
title: Server Actions
2+
title: サーバアクション
33
canary: true
44
---
55

66
<Intro>
77

8-
Server Actions allow Client Components to call async functions executed on the server.
8+
サーバアクション (Server Action) を使用することで、サーバで実行される非同期関数をクライアントコンポーネントから呼び出すことができます。
99

1010
</Intro>
1111

1212
<InlineToc />
1313

1414
<Note>
1515

16-
#### How do I build support for Server Actions? {/*how-do-i-build-support-for-server-actions*/}
16+
#### サーバアクションのサポートを追加する方法 {/*how-do-i-build-support-for-server-actions*/}
1717

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

20-
To support Server Actions 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 Server Actions in the future.
20+
サーバアクションをバンドラやフレームワークでサポートする場合は、特定の React バージョンに固定するか、Canary リリースを使用することをお勧めします。サーバアクションを実装するために使用される API を安定化させるため、今後もバンドラやフレームワークと連携を続けていきます。
2121

2222
</Note>
2323

24-
When a Server Action is defined with the `"use server"` directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.
24+
サーバアクションが `"use server"` ディレクティブを付けて定義されると、フレームワークは自動的にそのサーバ関数への参照を作成し、その参照をクライアントコンポーネントに渡します。クライアントでこの関数が呼び出されると、React はサーバにリクエストを送信して元の関数を実行し、その結果を返します。
2525

26-
Server Actions can be created in Server Components and passed as props to Client Components, or they can be imported and used in Client Components.
26+
サーバアクションはサーバコンポーネント内で作成し、クライアントコンポーネントに props として渡すことができます。また、クライアントコンポーネントで直接インポートして使用することも可能です。
2727

28-
### Creating a Server Action from a Server Component {/*creating-a-server-action-from-a-server-component*/}
28+
### サーバコンポーネントからサーバアクションを作成する {/*creating-a-server-action-from-a-server-component*/}
2929

30-
Server Components can define Server Actions with the `"use server"` directive:
30+
サーバコンポーネントは `"use server"` ディレクティブを使用してサーバアクションを定義できます。
3131

3232
```js [[2, 7, "'use server'"], [1, 5, "createNoteAction"], [1, 12, "createNoteAction"]]
3333
// Server Component
@@ -45,7 +45,7 @@ function EmptyNote () {
4545
}
4646
```
4747

48-
When React renders the `EmptyNote` Server Component, it will create a reference to the `createNoteAction` function, and pass that reference to the `Button` Client Component. When the button is clicked, React will send a request to the server to execute the `createNoteAction` function with the reference provided:
48+
React がサーバコンポーネントである `EmptyNote` をレンダーすると、`createNoteAction` 関数への参照を作成し、この参照をクライアントコンポーネントである `Button` に渡します。ボタンがクリックされると、React は渡された参照を使用してサーバにリクエストを送信し、`createNoteAction` 関数を実行します。
4949

5050
```js {5}
5151
"use client";
@@ -57,12 +57,12 @@ export default function Button({onClick}) {
5757
}
5858
```
5959

60-
For more, see the docs for [`"use server"`](/reference/rsc/use-server).
60+
詳細については、[`"use server"`](/reference/rsc/use-server) のドキュメントを参照してください。
6161

6262

63-
### Importing Server Actions from Client Components {/*importing-server-actions-from-client-components*/}
63+
### クライアントコンポーネントからサーバアクションをインポートする {/*importing-server-actions-from-client-components*/}
6464

65-
Client Components can import Server Actions from files that use the `"use server"` directive:
65+
クライアントコンポーネントは `"use server"` ディレクティブを使用するファイルから、サーバアクションをインポートできます。
6666

6767
```js [[1, 3, "createNoteAction"]]
6868
"use server";
@@ -73,7 +73,7 @@ export async function createNoteAction() {
7373

7474
```
7575

76-
When the bundler builds the `EmptyNote` Client Component, it will create a reference to the `createNoteAction` function in the bundle. When the `button` is clicked, React will send a request to the server to execute the `createNoteAction` function using the reference provided:
76+
バンドラがクライアントコンポーネントである `EmptyNote` をビルドする際に、バンドル内で `createNoteAction` 関数への参照を作成します。`button` がクリックされると、React は渡された参照を使用してサーバにリクエストを送信し、`createNoteAction` 関数を実行します。
7777

7878
```js [[1, 2, "createNoteAction"], [1, 5, "createNoteAction"], [1, 7, "createNoteAction"]]
7979
"use client";
@@ -86,11 +86,11 @@ function EmptyNote() {
8686
}
8787
```
8888

89-
For more, see the docs for [`"use server"`](/reference/rsc/use-server).
89+
詳細については、[`"use server"`](/reference/rsc/use-server) のドキュメントを参照してください。
9090

91-
### Composing Server Actions with Actions {/*composing-server-actions-with-actions*/}
91+
### アクションとサーバアクションを組み合わせる {/*composing-server-actions-with-actions*/}
9292

93-
Server Actions can be composed with Actions on the client:
93+
サーバアクションはクライアントのアクションと組み合わせることができます。
9494

9595
```js [[1, 3, "updateName"]]
9696
"use server";
@@ -134,15 +134,15 @@ function UpdateName() {
134134
}
135135
```
136136

137-
This allows you to access the `isPending` state of the Server Action by wrapping it in an Action on the client.
137+
このようにクライアント側のアクションでラップすることで、サーバアクションによる `isPending` state にアクセスできます。
138138

139-
For more, see the docs for [Calling a Server Action outside of `<form>`](/reference/rsc/use-server#calling-a-server-action-outside-of-form)
139+
詳細については、[フォーム外でサーバアクションを呼び出す](/reference/rsc/use-server#calling-a-server-action-outside-of-form)を参照してください。
140140

141-
### Form Actions with Server Actions {/*form-actions-with-server-actions*/}
141+
### フォームアクションとサーバアクション {/*form-actions-with-server-actions*/}
142142

143-
Server Actions work with the new Form features in React 19.
143+
サーバアクションは React 19 の新しいフォーム関連機能と連携します。
144144

145-
You can pass a Server Action to a Form to automatically submit the form to the server:
145+
フォームにサーバアクションを渡すことで、自動的にフォームをサーバに送信できます。
146146

147147

148148
```js [[1, 3, "updateName"], [1, 7, "updateName"]]
@@ -159,13 +159,13 @@ function UpdateName() {
159159
}
160160
```
161161

162-
When the Form submission succeeds, React will automatically reset the form. You can add `useActionState` to access the pending state, last response, or to support progressive enhancement.
162+
フォームの送信が成功すると、React は自動的にフォームをリセットします。`useActionState` を追加して、進行中 (pending) state や最終的なレスポンスにアクセスしたり、プログレッシブエンハンスメント (progressive enhancement) をサポートしたりすることが可能です。
163163

164-
For more, see the docs for [Server Actions in Forms](/reference/rsc/use-server#server-actions-in-forms).
164+
詳細については、[フォーム内でのサーバアクション](/reference/rsc/use-server#server-actions-in-forms)を参照してください。
165165

166-
### Server Actions with `useActionState` {/*server-actions-with-use-action-state*/}
166+
### `useActionState` とサーバアクション {/*server-actions-with-use-action-state*/}
167167

168-
You can compose Server Actions with `useActionState` for the common case where you just need access to the action pending state and last returned response:
168+
`useActionState` とサーバアクションを組み合わせることで、アクションの進行中 state と最後に返されたレスポンスにアクセスする、という一般的なユースケースに対応できます。
169169

170170
```js [[1, 3, "updateName"], [1, 6, "updateName"], [2, 6, "submitAction"], [2, 9, "submitAction"]]
171171
"use client";
@@ -184,13 +184,13 @@ function UpdateName() {
184184
}
185185
```
186186

187-
When using `useActionState` with Server Actions, React will also automatically replay form submissions entered before hydration finishes. This means users can interact with your app even before the app has hydrated.
187+
サーバアクションと `useActionState` を使用する場合、React はハイドレーションの完了前に実行されたフォーム送信を自動的に再現します。これにより、ユーザはアプリのハイドレーションが起きる前からアプリを操作できるようになります。
188188

189-
For more, see the docs for [`useActionState`](/reference/react-dom/hooks/useFormState).
189+
詳細については、[`useActionState`](/reference/react-dom/hooks/useFormState) のドキュメントを参照してください。
190190

191-
### Progressive enhancement with `useActionState` {/*progressive-enhancement-with-useactionstate*/}
191+
### `useActionState` を使用したプログレッシブエンハンスメント {/*progressive-enhancement-with-useactionstate*/}
192192

193-
Server Actions also support progressive enhancement with the third argument of `useActionState`.
193+
サーバアクションは `useActionState` の第 3 引数を使用してプログレッシブエンハンスメントもサポートします。
194194

195195
```js [[1, 3, "updateName"], [1, 6, "updateName"], [2, 6, "/name/update"], [3, 6, "submitAction"], [3, 9, "submitAction"]]
196196
"use client";
@@ -208,6 +208,6 @@ function UpdateName() {
208208
}
209209
```
210210

211-
When the <CodeStep step={2}>permalink</CodeStep> is provided to `useActionState`, React will redirect to the provided URL if the form is submitted before the JavaScript bundle loads.
211+
<CodeStep step={2}>パーマリンク</CodeStep>`useActionState` に渡された場合、JavaScript バンドルが読み込まれる前にフォームが送信されると、React はこの渡された URL にリダイレクトします。
212212

213-
For more, see the docs for [`useActionState`](/reference/react-dom/hooks/useFormState).
213+
詳しくは、[`useActionState`](/reference/react-dom/hooks/useFormState) のドキュメントを参照してください。

src/sidebarReference.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@
365365
"canary": true
366366
},
367367
{
368-
"title": "Server Actions",
368+
"title": "サーバアクション",
369369
"path": "/reference/rsc/server-actions",
370370
"canary": true
371371
},

0 commit comments

Comments
 (0)