From 3cdc871b05fd3ba9009c0b69fbb09f29df73686c Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Wed, 6 Mar 2024 23:36:51 -0800 Subject: [PATCH] document useSession --- site/src/routes/api/react/+page.svx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site/src/routes/api/react/+page.svx b/site/src/routes/api/react/+page.svx index 25def6d27b..3662b623fc 100644 --- a/site/src/routes/api/react/+page.svx +++ b/site/src/routes/api/react/+page.svx @@ -543,6 +543,17 @@ const config = { export default config ``` +To access the current session, you can use the `useSession` hook: + +```javascript +import { useSession } from '$houdini' + +const [ session, setSession ] = useSession() +``` + +Calling `setSession` updates the client-side session as well as perists the new values in the application +cookie so that its available on the next load. + ## Local APIs For many applications, the API can live in the same codebase as the UI. When that happens, there