diff --git a/src/content/reference/react/use-server.md b/src/content/reference/react/use-server.md index 572969ac2..9e19f5ab1 100644 --- a/src/content/reference/react/use-server.md +++ b/src/content/reference/react/use-server.md @@ -34,77 +34,77 @@ async function addToCart(data) { } ``` -When calling a server action on the client, it will make a network request to the server that includes a serialized copy of any arguments passed. If the server action returns a value, that value will be serialized and returned to the client. +Lorsque vous appelez une action serveur côté client, elle fait une requête réseau auprès du serveur en incluant une copie sérialisée des arguments que vous avez passés. Si l'action serveur renvoie une valeur, cette valeur sera sérialisée puis renvoyée au client. -Instead of individually marking functions with `'use server'`, you can add the directive to the top of a file to mark all exports within that file as server actions that can be used anywhere, including imported in client code. +Plutôt que de marquer chaque fonction concernée avec `'use server'`, vous pouvez ajouter cette directive tout en haut d'un fichier afin d'en marquer tous les exports comme des actions serveur utilisables n'importe où, y compris au travers d'imports par du code client. #### Limitations {/*caveats*/} -* `'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. -* `'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). -* To import a server action from [client code](/reference/react/use-client), the directive must be used on a module level. -* Because the underlying network calls are always asynchronous, `'use server'` can only be used on async functions. -* Always treat arguments to server actions as untrusted input and authorize any mutations. See [security considerations](#security). -* Server actions should be called in a [transition](/reference/react/useTransition). Server actions passed to [`
} ``` -In this example `requestUsername` is a server action passed to a ` -Last submission request returned: {returnValue}
+Résultat de la dernière réservation : {returnValue}
> ); } ``` -Note that like most Hooks, `useFormState` can only be called in