Skip to content

Commit 4ce955b

Browse files
authored
Merge pull request #33 from reactjs/sync-6570e6cd
Sync with react.dev @ 6570e6c
2 parents 79c6398 + eccc1c4 commit 4ce955b

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To display an input, render the [built-in browser `<input>`](https://developer.m
3434

3535
<Canary>
3636

37-
React's extensions to the `formAction` prop are currently only available in React's Canary and experimental channels. In stable releases of React `formAction` works only as a [built-in browser HTML component]
37+
React's extensions to the `formAction` prop are currently only available in React's Canary and experimental channels. In stable releases of React `formAction` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components). Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
3838
</Canary>
3939

4040
[`formAction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction): A string or function. Overrides the parent `<form action>` for `type="submit"` and `type="image"`. When a URL is passed to `action` the form will behave like a standard HTML form. When a function is passed to `formAction` the function will handle the form submission. See [`<form action>`](/reference/react-dom/components/form#props).

src/content/reference/react-dom/hooks/useFormStatus.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function Submit() {
3838
return <button disabled={status.pending}>Submit</button>
3939
}
4040

41-
export default App() {
41+
export default function App() {
4242
return (
4343
<form action={action}>
4444
<Submit />

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ async function requestUsername(formData) {
115115
// ...
116116
}
117117

118-
export default App() {
119-
<form action={requestUsername}>
120-
<input type="text" name="username" />
121-
<button type="submit">Request</button>
122-
</form>
118+
export default function App() {
119+
return (
120+
<form action={requestUsername}>
121+
<input type="text" name="username" />
122+
<button type="submit">Request</button>
123+
</form>
124+
);
123125
}
124126
```
125127

@@ -176,6 +178,7 @@ Note that like most Hooks, `useFormState` can only be called in <CodeStep step={
176178
Server Actions are exposed server endpoints and can be called anywhere in client code.
177179

178180
When using a Server Action outside of a [form](/reference/react-dom/components/form), call the Server Action in a [transition](/reference/react/useTransition), which allows you to display a loading indicator, show [optimistic state updates](/reference/react/useOptimistic), and handle unexpected errors. Forms will automatically wrap Server Actions in transitions.
181+
179182
```js {9-12}
180183
import incrementLike from './actions';
181184
import { useState, useTransition } from 'react';

src/content/reference/react/useOptimistic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default function App() {
116116
]);
117117
async function sendMessage(formData) {
118118
const sentMessage = await deliverMessage(formData.get("message"));
119-
setMessages((messages) => [...messages, { text: sentMessage }]);
119+
setMessages((messages) => [...messages, { text: sentMessage }]);
120120
}
121121
return <Thread messages={messages} sendMessage={sendMessage} />;
122122
}

src/content/reference/react/useSyncExternalStore.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The current snapshot of the store which you can use in your rendering logic.
5757
5858
* If a different `subscribe` function is passed during a re-render, React will re-subscribe to the store using the newly passed `subscribe` function. You can prevent this by declaring `subscribe` outside the component.
5959
60-
* If the store is mutated during a [non-blocking transition update](/reference/react/useTransition), React will fall back to performing that update as blocking. Specifically, React will call `getSnapshot` a second time just before applying changes to the DOM. If it returns a different value than when it was called originally, React will restart the transition update from scratch, this time applying it as a blocking update, to ensure that every component on screen is reflecting the same version of the store.
60+
* If the store is mutated during a [non-blocking transition update](/reference/react/useTransition), React will fall back to performing that update as blocking. Specifically, for every transition update, React will call `getSnapshot` a second time just before applying changes to the DOM. If it returns a different value than when it was called originally, React will restart the update from scratch, this time applying it as a blocking update, to ensure that every component on screen is reflecting the same version of the store.
6161
6262
* It's not recommended to _suspend_ a render based on a store value returned by `useSyncExternalStore`. The reason is that mutations to the external store cannot be [marked as non-blocking transition updates](/reference/react/useTransition), so they will trigger the nearest [`Suspense` fallback](/reference/react/Suspense), replacing already-rendered content on screen with a loading spinner, which typically makes a poor UX.
6363

0 commit comments

Comments
 (0)