Isomorphic hook to access cookies #73330
wintercounter
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
useCookies
hook that works both during CSR and SSR.Non-Goals
No response
Background
Currently, in Next 14 we have our own isomorphic hook to read cookies. Some layouts are based on cookies. Using this we can avoid hydration mismatches, and we don't need to wait on client side for our app to load to read cookies (which would result in layout shifts).
Here's a simplified example of what we're doing now:
In NextJS 15
cookies()
is now async (I know it still works temporarily sync), which doesn't let us migrate.Proposal
Just like there's isomorphic
useSearchParams
,useParams
, etc., there should be an isomorphicuseCookies
equivalent.Beta Was this translation helpful? Give feedback.
All reactions