TanStackT
TanStack12mo ago
4 replies
dry-scarlet

Access cookies in loader/serverFn/client

I'm having a hard time trying to use the cookies in tanstack start.

https://stackblitz.com/edit/tanstack-router-z2md6zd1?file=app%2Fcookie-loader.ts

In __root.tsx loader is a function to initialize the cookie with a value.

I then have 3 different ways to load the cookie:
* Directly in the loader
* Loader calling a server fn
* Client calling a server fn

None of those approaches work, they all fail with "Context is not available".
Was this page helpful?