Skip to content

Commit

Permalink
docs: improve transferToClient explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca committed Dec 22, 2024
1 parent 5394169 commit 4cce154
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/api-reference/components/request-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export default async function SomeComponent({}, request: RequestContext) {
request.store.set("data", data);

// Transfer "data" from store to client
// You extend the life of the store from request-time:
// render (server) → 💀
// to:
// render (server) → client → action (server) → rerender (server) → client → ...
request.store.transferToClient(["data"]);

// ..
Expand Down
6 changes: 5 additions & 1 deletion docs/building-your-application/routing/pages-and-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ export default async function Layout({}, request: RequestContext) {

request.store.set("data", data);

// Transfer "data" from store to client
// Transfer "data" from store to client
// You extend the life of the store from request-time:
// render (server) → 💀
// to:
// render (server) → client → action (server) → rerender (server) → client → ...
request.store.transferToClient(["data"]);

return (
Expand Down

0 comments on commit 4cce154

Please sign in to comment.