Skip to content

Commit

Permalink
docs: note that useCookie does not share state (#20665)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiewarb committed May 4, 2023
1 parent 0508ec2 commit c543ea8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/3.api/1.composables/use-cookie.md
Expand Up @@ -18,6 +18,10 @@ const cookie = useCookie(name, options)
`useCookie` ref will automatically serialize and deserialize cookie value to JSON.
::

::alert{icon=⚠️}
Multiple invocations of `useCookie` with the same name are not synced. [You can utilise `useState()` to sync them as a workaround](https://github.com/nuxt/nuxt/issues/13020#issuecomment-1505548242).
::

## Example

The example below creates a cookie called `counter`. If the cookie doesn't exist, it is initially set to a random value. Whenever we update the `counter` variable, the cookie will be updated accordingly.
Expand Down

0 comments on commit c543ea8

Please sign in to comment.