Skip to content

Commit 9f70230

Browse files
committed
Add a tip about "use server" to action docs
1 parent e916c2e commit 9f70230

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/routes/solid-router/concepts/actions.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ In this example, the `echo` action simulates a fetch call with a 1 second delay
4343
The `echo` action will act as a backend, however, it can be substituted for any API provided it can be run on the client.
4444
Typically, route actions are used with some sort of solution like fetch or GraphQL.
4545

46+
<Callout type="tip">
47+
48+
In [SolidStart](/solid-start) apps, it's recommended to use the [`"use server"`](/solid-start/reference/server/use-server) directive to leverage server-side caching.
49+
50+
</Callout>
51+
4652
### Using actions
4753

4854
To use the action, you can call it from within a component using [`useAction`](/solid-router/reference/data-apis/use-action).

src/routes/solid-router/reference/data-apis/action.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ const deleteTodo = action(async (id: number) => {
5959

6060
```
6161

62+
<Callout type="tip">
63+
64+
In [SolidStart](/solid-start) apps, it's recommended to use the [`"use server"`](/solid-start/reference/server/use-server) directive to leverage server-side caching.
65+
66+
</Callout>
67+
6268
## Notes of `<form>` implementation and SSR
6369

6470
This requires stable references because a string can only be serialized as an attribute, and it is crucial for consistency across SSR. where these references must align.

0 commit comments

Comments
 (0)