Skip to content

Commit d5dbaee

Browse files
committed
docs: recommend plain devalue
1 parent 84c935e commit d5dbaee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/docs/ssr/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ onServerPrefetch(async () => {
6363

6464
## State hydration
6565

66-
To hydrate the initial state, you need to make sure the rootState is included somewhere in the HTML for Pinia to pick it up later on. Depending on what you are using for SSR, **you should escape the state for security reasons**. We recommend using [@nuxt/devalue](https://github.com/nuxt-contrib/devalue) which is the one used by Nuxt.js:
66+
To hydrate the initial state, you need to make sure the rootState is included somewhere in the HTML for Pinia to pick it up later on. Depending on what you are using for SSR, **you should escape the state for security reasons**. We recommend using [devalue](https://github.com/Rich-Harris/devalue) which is the one used by Nuxt.js:
6767

6868
```js
69-
import devalue from '@nuxt/devalue'
69+
import devalue from 'devalue'
7070
import { createPinia } from 'pinia'
7171
// retrieve the rootState server side
7272
const pinia = createPinia()
@@ -83,7 +83,7 @@ app.use(pinia)
8383
devalue(pinia.state.value)
8484
```
8585

86-
Depending on what you are using for SSR, you will set an _initial state_ variable that will be serialized in the HTML. You should also protect yourself from XSS attacks. You can use [other alternatives](https://github.com/nuxt-contrib/devalue#see-also) to `@nuxt/devalue` depending on what you need, e.g. if you can serialize and parse your state with `JSON.stringify()`/`JSON.parse()`, **you could improve your performance by a lot**.
86+
Depending on what you are using for SSR, you will set an _initial state_ variable that will be serialized in the HTML. You should also protect yourself from XSS attacks. You can use [other alternatives](https://github.com/Rich-Harris/devalue#see-also) to `devalue` depending on what you need, e.g. if you can serialize and parse your state with `JSON.stringify()`/`JSON.parse()`, **you could improve your performance by a lot**.
8787

8888
If you are not using Nuxt you will need to handle the serialization and hydration of the state yourself. Here are some examples:
8989

0 commit comments

Comments
 (0)