Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2403d6e

Browse files
committed
(docs): add section on Node and SSR Usage
- note that one can hydrate server-side with Node and give some example storage engines one may use for that purpose- note that server-side hydartion can be skipped for certain use cases like SSR and give example for how to do so
1 parenta36a41b commit2403d6e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ persist('some', someStore, {
6565

6666
- returns a void Promise
6767

68+
###Node and Server-Side Rendering (SSR) Usage
69+
70+
Node environments are supported so long as you configure a Storage Engine that supports Node, such as[`redux-persist-node-storage`](https://github.com/pellejacobs/redux-persist-node-storage),[`redux-persist-cookie-storage`](https://github.com/abersager/redux-persist-cookie-storage), etc.
71+
This allows you to hydrate your store server-side.
72+
73+
For SSR though, you may not want to hydrate your store server-side, so in that case you can call`persist` conditionally:
74+
75+
```javascript
76+
if (typeofwindow!=='undefined') {// window is undefined in Node
77+
persist(...)
78+
}
79+
```
80+
81+
With this conditional check, your store will only be hydrated client-side.
82+
6883
##Examples
6984

7085
None yet, but can take a look at[agilgur5/react-native-manga-reader-app](https://github.com/agilgur5/react-native-manga-reader-app) which uses it in production.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp