diff --git a/docs/content/2.guide/2.features/6.state-management.md b/docs/content/2.guide/2.features/6.state-management.md index 727064711ce..f1f83bcb2e3 100644 --- a/docs/content/2.guide/2.features/6.state-management.md +++ b/docs/content/2.guide/2.features/6.state-management.md @@ -10,6 +10,9 @@ Nuxt provides `useState` composable to create a reactive and SSR-friendly shared ::alert{icon=👉} `useState` only works during `setup` or [`Lifecycle Hooks`](https://vuejs.org/api/composition-api-lifecycle.html#composition-api-lifecycle-hooks). :: +::alert{type=warning} +Because the data inside `useState` will be serialized to JSON, it is important that it does not contain anything that cannot be serialized, such as classes, functions or symbols. +:: ## Best practices diff --git a/docs/content/3.api/1.composables/use-state.md b/docs/content/3.api/1.composables/use-state.md index 30ac7d5c4e2..f854881b320 100644 --- a/docs/content/3.api/1.composables/use-state.md +++ b/docs/content/3.api/1.composables/use-state.md @@ -9,5 +9,9 @@ useState(key: string, init?: () => T | Ref): Ref * **init**: A function that provides initial value for the state when not initiated. This function can also return a `Ref`. * **T**: (typescript only) Specify the type of state +::alert{type=warning} +Because the data inside `useState` will be serialized to JSON, it is important that it does not contain anything that cannot be serialized, such as classes, functions or symbols. +:: + ::ReadMore{link="/guide/features/state-management"} ::