Skip to content

Commit 057f35c

Browse files
Replaced all instances of /react to /rsc (#6797)
1 parent e45ac55 commit 057f35c

10 files changed

+24
-24
lines changed

src/content/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ We refer to this broader collection of features as simply "Actions". Actions all
5252
</form>
5353
```
5454

55-
The `action` function can operate synchronously or asynchronously. You can define them on the client side using standard JavaScript or on the server with the [`'use server'`](/reference/react/use-server) directive. When using an action, React will manage the life cycle of the data submission for you, providing hooks like [`useFormStatus`](/reference/react-dom/hooks/useFormStatus), and [`useActionState`](/reference/react/useActionState) to access the current state and response of the form action.
55+
The `action` function can operate synchronously or asynchronously. You can define them on the client side using standard JavaScript or on the server with the [`'use server'`](/reference/rsc/use-server) directive. When using an action, React will manage the life cycle of the data submission for you, providing hooks like [`useFormStatus`](/reference/react-dom/hooks/useFormStatus), and [`useActionState`](/reference/react/useActionState) to access the current state and response of the form action.
5656

5757
By default, Actions are submitted within a [transition](/reference/react/useTransition), keeping the current page interactive while the action is processing. Since Actions support async functions, we've also added the ability to use `async/await` in transitions. This allows you to show pending UI with the `isPending` state of a transition when an async request like `fetch` starts, and show the pending UI all the way through the update being applied.
5858

@@ -72,7 +72,7 @@ Canaries are a change to the way we develop React. Previously, features would be
7272

7373
React Server Components, Asset Loading, Document Metadata, and Actions have all landed in the React Canary, and we've added docs for these features on react.dev:
7474

75-
- **Directives**: [`"use client"`](/reference/react/use-client) and [`"use server"`](/reference/react/use-server) are bundler features designed for full-stack React frameworks. They mark the "split points" between the two environments: `"use client"` instructs the bundler to generate a `<script>` tag (like [Astro Islands](https://docs.astro.build/en/concepts/islands/#creating-an-island)), while `"use server"` tells the bundler to generate a POST endpoint (like [tRPC Mutations](https://trpc.io/docs/concepts)). Together, they let you write reusable components that compose client-side interactivity with the related server-side logic.
75+
- **Directives**: [`"use client"`](/reference/rsc/use-client) and [`"use server"`](/reference/rsc/use-server) are bundler features designed for full-stack React frameworks. They mark the "split points" between the two environments: `"use client"` instructs the bundler to generate a `<script>` tag (like [Astro Islands](https://docs.astro.build/en/concepts/islands/#creating-an-island)), while `"use server"` tells the bundler to generate a POST endpoint (like [tRPC Mutations](https://trpc.io/docs/concepts)). Together, they let you write reusable components that compose client-side interactivity with the related server-side logic.
7676

7777
- **Document Metadata**: we added built-in support for rendering [`<title>`](/reference/react-dom/components/title), [`<meta>`](/reference/react-dom/components/meta), and metadata [`<link>`](/reference/react-dom/components/link) tags anywhere in your component tree. These work the same way in all environments, including fully client-side code, SSR, and RSC. This provides built-in support for features pioneered by libraries like [React Helmet](https://github.com/nfl/react-helmet).
7878

src/content/reference/react-dom/components/form.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default function Search() {
9393

9494
### Handle form submission with a Server Action {/*handle-form-submission-with-a-server-action*/}
9595

96-
Render a `<form>` with an input and submit button. Pass a Server Action (a function marked with [`'use server'`](/reference/react/use-server)) to the `action` prop of form to run the function when the form is submitted.
96+
Render a `<form>` with an input and submit button. Pass a Server Action (a function marked with [`'use server'`](/reference/rsc/use-server)) to the `action` prop of form to run the function when the form is submitted.
9797

9898
Passing a Server Action to `<form action>` allow users to submit forms without JavaScript enabled or before the code has loaded. This is beneficial to users who have a slow connection, device, or have JavaScript disabled and is similar to the way forms work when a URL is passed to the `action` prop.
9999

@@ -137,7 +137,7 @@ function AddToCart({productId}) {
137137
}
138138
```
139139

140-
When `<form>` is rendered by a [Server Component](/reference/react/use-client), and a [Server Action](/reference/react/use-server) is passed to the `<form>`'s `action` prop, the form is [progressively enhanced](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement).
140+
When `<form>` is rendered by a [Server Component](/reference/rsc/use-client), and a [Server Action](/reference/rsc/use-server) is passed to the `<form>`'s `action` prop, the form is [progressively enhanced](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement).
141141

142142
### Display a pending state during form submission {/*display-a-pending-state-during-form-submission*/}
143143
To display a pending state when a form is being submitted, you can call the `useFormStatus` Hook in a component rendered in a `<form>` and read the `pending` property returned.
@@ -322,11 +322,11 @@ export default function Search() {
322322

323323
Displaying a form submission error message before the JavaScript bundle loads for progressive enhancement requires that:
324324

325-
1. `<form>` be rendered by a [Server Component](/reference/react/use-client)
326-
1. the function passed to the `<form>`'s `action` prop be a [Server Action](/reference/react/use-server)
325+
1. `<form>` be rendered by a [Server Component](/reference/rsc/use-client)
326+
1. the function passed to the `<form>`'s `action` prop be a [Server Action](/reference/rsc/use-server)
327327
1. the `useActionState` Hook be used to display the error message
328328

329-
`useActionState` takes two parameters: a [Server Action](/reference/react/use-server) and an initial state. `useActionState` returns two values, a state variable and an action. The action returned by `useActionState` should be passed to the `action` prop of the form. The state variable returned by `useActionState` can be used to displayed an error message. The value returned by the [Server Action](/reference/react/use-server) passed to `useActionState` will be used to update the state variable.
329+
`useActionState` takes two parameters: a [Server Action](/reference/rsc/use-server) and an initial state. `useActionState` returns two values, a state variable and an action. The action returned by `useActionState` should be passed to the `action` prop of the form. The state variable returned by `useActionState` can be used to displayed an error message. The value returned by the [Server Action](/reference/rsc/use-server) passed to `useActionState` will be used to update the state variable.
330330

331331
<Sandpack>
332332

src/content/reference/react/experimental_taintUniqueValue.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can try it by upgrading React packages to the most recent experimental versi
1414

1515
Experimental versions of React may contain bugs. Don't use them in production.
1616

17-
This API is only available inside [React Server Components](/reference/react/use-client).
17+
This API is only available inside [React Server Components](/reference/rsc/use-client).
1818

1919
</Wip>
2020

src/content/reference/react/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Programmatic React features:
1717
* [Hooks](/reference/react/hooks) - Use different React features from your components.
1818
* [Components](/reference/react/components) - Documents built-in components that you can use in your JSX.
1919
* [APIs](/reference/react/apis) - APIs that are useful for defining components.
20-
* [Directives](/reference/react/directives) - Provide instructions to bundlers compatible with React Server Components.
20+
* [Directives](/reference/rsc/directives) - Provide instructions to bundlers compatible with React Server Components.
2121

2222
## React DOM {/*react-dom*/}
2323

src/content/reference/react/use.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ The `use` API returns the value that was read from the resource like the resolve
5555
#### Caveats {/*caveats*/}
5656
5757
* The `use` API must be called inside a Component or a Hook.
58-
* When fetching data in a [Server Component](/reference/react/use-server), prefer `async` and `await` over `use`. `async` and `await` pick up rendering from the point where `await` was invoked, whereas `use` re-renders the component after the data is resolved.
59-
* Prefer creating Promises in [Server Components](/reference/react/use-server) and passing them to [Client Components](/reference/react/use-client) over creating Promises in Client Components. Promises created in Client Components are recreated on every render. Promises passed from a Server Component to a Client Component are stable across re-renders. [See this example](#streaming-data-from-server-to-client).
58+
* When fetching data in a [Server Component](/reference/rsc/use-server), prefer `async` and `await` over `use`. `async` and `await` pick up rendering from the point where `await` was invoked, whereas `use` re-renders the component after the data is resolved.
59+
* Prefer creating Promises in [Server Components](/reference/rsc/use-server) and passing them to [Client Components](/reference/rsc/use-client) over creating Promises in Client Components. Promises created in Client Components are recreated on every render. Promises passed from a Server Component to a Client Component are stable across re-renders. [See this example](#streaming-data-from-server-to-client).
6060
6161
---
6262

src/content/reference/react/useActionState.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ canary: true
55

66
<Canary>
77

8-
The `useActionState` Hook is currently only available in React's Canary and experimental channels. Learn more about [release channels here](/community/versioning-policy#all-release-channels). In addition, you need to use a framework that supports [React Server Components](/reference/react/use-client) to get the full benefit of `useActionState`.
8+
The `useActionState` Hook is currently only available in React's Canary and experimental channels. Learn more about [release channels here](/community/versioning-policy#all-release-channels). In addition, you need to use a framework that supports [React Server Components](/reference/rsc/use-client) to get the full benefit of `useActionState`.
99

1010
</Canary>
1111

@@ -65,7 +65,7 @@ If used with a Server Action, `useActionState` allows the server's response from
6565
6666
* `fn`: The function to be called when the form is submitted or button pressed. When the function is called, it will receive the previous state of the form (initially the `initialState` that you pass, subsequently its previous return value) as its initial argument, followed by the arguments that a form action normally receives.
6767
* `initialState`: The value you want the state to be initially. It can be any serializable value. This argument is ignored after the action is first invoked.
68-
* **optional** `permalink`: A string containing the unique page URL that this form modifies. For use on pages with dynamic content (eg: feeds) in conjunction with progressive enhancement: if `fn` is a [server action](/reference/react/use-server) and the form is submitted before the JavaScript bundle loads, the browser will navigate to the specified permalink URL, rather than the current page's URL. Ensure that the same form component is rendered on the destination page (including the same action `fn` and `permalink`) so that React knows how to pass the state through. Once the form has been hydrated, this parameter has no effect.
68+
* **optional** `permalink`: A string containing the unique page URL that this form modifies. For use on pages with dynamic content (eg: feeds) in conjunction with progressive enhancement: if `fn` is a [server action](/reference/rsc/use-server) and the form is submitted before the JavaScript bundle loads, the browser will navigate to the specified permalink URL, rather than the current page's URL. Ensure that the same form component is rendered on the destination page (including the same action `fn` and `permalink`) so that React knows how to pass the state through. Once the form has been hydrated, this parameter has no effect.
6969
7070
{/* TODO T164397693: link to serializable values docs once it exists */}
7171

src/content/reference/rsc/directives.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ Directives provide instructions to [bundlers compatible with React Server Compon
1919

2020
## Source code directives {/*source-code-directives*/}
2121

22-
* [`'use client'`](/reference/react/use-client) lets you mark what code runs on the client.
23-
* [`'use server'`](/reference/react/use-server) marks server-side functions that can be called from client-side code.
22+
* [`'use client'`](/reference/rsc/use-client) lets you mark what code runs on the client.
23+
* [`'use server'`](/reference/rsc/use-server) marks server-side functions that can be called from client-side code.

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function Button({onClick}) {
5757
}
5858
```
5959

60-
For more, see the docs for [`"use server"`](/reference/react/use-server).
60+
For more, see the docs for [`"use server"`](/reference/rsc/use-server).
6161

6262

6363
### Importing Server Actions from Client Components {/*importing-server-actions-from-client-components*/}
@@ -86,7 +86,7 @@ function EmptyNote() {
8686
}
8787
```
8888

89-
For more, see the docs for [`"use server"`](/reference/react/use-server).
89+
For more, see the docs for [`"use server"`](/reference/rsc/use-server).
9090

9191
### Composing Server Actions with Actions {/*composing-server-actions-with-actions*/}
9292

@@ -136,7 +136,7 @@ function UpdateName() {
136136

137137
This allows you to access the `isPending` state of the Server Action by wrapping it in an Action on the client.
138138

139-
For more, see the docs for [Calling a Server Action outside of `<form>`](/reference/react/use-server#calling-a-server-action-outside-of-form)
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)
140140

141141
### Form Actions with Server Actions {/*form-actions-with-server-actions*/}
142142

@@ -161,7 +161,7 @@ function UpdateName() {
161161

162162
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.
163163

164-
For more, see the docs for [Server Actions in Forms](/reference/react/use-server#server-actions-in-forms).
164+
For more, see the docs for [Server Actions in Forms](/reference/rsc/use-server#server-actions-in-forms).
165165

166166
### Server Actions with `useActionState` {/*server-actions-with-use-action-state*/}
167167

src/content/reference/rsc/use-client.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ Serializable props include:
269269
* [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) and [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
270270
* [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
271271
* Plain [objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object): those created with [object initializers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer), with serializable properties
272-
* Functions that are [Server Actions](/reference/react/use-server)
272+
* Functions that are [Server Actions](/reference/rsc/use-server)
273273
* Client or Server Component elements (JSX)
274274
* [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
275275

276276
Notably, these are not supported:
277-
* [Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) that are not exported from client-marked modules or marked with [`'use server'`](/reference/react/use-server)
277+
* [Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) that are not exported from client-marked modules or marked with [`'use server'`](/reference/rsc/use-server)
278278
* [Classes](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Classes_in_JavaScript)
279279
* Objects that are instances of any class (other than the built-ins mentioned) or objects with [a null prototype](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#null-prototype_objects)
280280
* Symbols not registered globally, ex. `Symbol('my new symbol')`

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Instead of individually marking functions with `'use server'`, you can add the d
4141
#### Caveats {/*caveats*/}
4242
* `'use server'` must be at the very beginning of their function or module; above any other code including imports (comments above directives are OK). They must be written with single or double quotes, not backticks.
4343
* `'use server'` can only be used in server-side files. The resulting Server Actions can be passed to Client Components through props. See supported [types for serialization](#serializable-parameters-and-return-values).
44-
* To import a Server Action from [client code](/reference/react/use-client), the directive must be used on a module level.
44+
* To import a Server Action from [client code](/reference/rsc/use-client), the directive must be used on a module level.
4545
* Because the underlying network calls are always asynchronous, `'use server'` can only be used on async functions.
4646
* Always treat arguments to Server Actions as untrusted input and authorize any mutations. See [security considerations](#security).
4747
* Server Actions should be called in a [Transition](/reference/react/useTransition). Server Actions passed to [`<form action>`](/reference/react-dom/components/form#props) or [`formAction`](/reference/react-dom/components/input#props) will automatically be called in a transition.
@@ -95,7 +95,7 @@ Notably, these are not supported:
9595
* Symbols not registered globally, ex. `Symbol('my new symbol')`
9696

9797

98-
Supported serializable return values are the same as [serializable props](/reference/react/use-client#passing-props-from-server-to-client-components) for a boundary Client Component.
98+
Supported serializable return values are the same as [serializable props](/reference/rsc/use-client#passing-props-from-server-to-client-components) for a boundary Client Component.
9999

100100

101101
## Usage {/*usage*/}
@@ -171,7 +171,7 @@ function UsernameForm() {
171171
}
172172
```
173173

174-
Note that like most Hooks, `useActionState` can only be called in <CodeStep step={1}>[client code](/reference/react/use-client)</CodeStep>.
174+
Note that like most Hooks, `useActionState` can only be called in <CodeStep step={1}>[client code](/reference/rsc/use-client)</CodeStep>.
175175

176176
### Calling a Server Action outside of `<form>` {/*calling-a-server-action-outside-of-form*/}
177177

0 commit comments

Comments
 (0)