From 07ba36d721c353ad86e4b7c6b72280e6f84fdf58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 16 Nov 2021 17:12:36 +0100 Subject: [PATCH] docs: useState improvements (#1973) --- docs/content/3.docs/1.usage/2.state.md | 39 +++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/docs/content/3.docs/1.usage/2.state.md b/docs/content/3.docs/1.usage/2.state.md index 4a465bf87b..04f86530df 100644 --- a/docs/content/3.docs/1.usage/2.state.md +++ b/docs/content/3.docs/1.usage/2.state.md @@ -1,22 +1,13 @@ # State -Nuxt provides `useState` to create a globally shared state within the context. +Nuxt provides `useState` composable to create a reactive and ssr-friendly shared state across components. -`useState` is SSR-friendly `ref` replacement in that its value will be hydrated (preserved) after server-side rendering and is shared across all components using a unique key. +`useState` is a SSR-friendly [`ref`](https://v3.vuejs.org/api/refs-api.html#ref) replacement. Its value will be preserved after server-side rendering (during client-side hydration) and shared across all components using a unique key. -::alert{icon=⚠️} -Never define `const state = ref()` outside of ` ```