You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using `"use server"`, regardless of whether rendering is happening on the server or in the browser, the functions it apply to will only run on the server.
16
+
When using `"use server"`, regardless of whether server rendering is enabled, the functions it apply to will only run on the server.
17
17
18
18
To do this, compilation is used to transform the `"use server"` function into an RPC call to the server.
In both of these examples, the `logHello` function, it would only show in the server console regardless of whether rendering was on the server or in the browser
41
+
In both of these examples, the `logHello` function, it would only show in the server console regardless of whether rendering was on the server or in the browser.
42
+
43
+
## Usage with Data APIs
44
+
45
+
Server functions can be used for fetching data and performing actions on the server.
46
+
The following examples show how to use server functions alongside solid-router's data APIs.
When `getUser` or `updateUser` are invoked on the client, an http request will be made to the server, which calls the corresponding server function.
63
+
64
+
## Single-flight actions
65
+
66
+
In the above example, when the `updateUser` action is called, a redirect is thrown on the server.
67
+
Solid Start can handle this redirect on the server instead of propagating it to the client.
68
+
The data for the redirected page is fetched and streamed to the client in the same http request as the `updateUser` action, rather than the client requiring a separate http request for the redirected page.
0 commit comments