Skip to content

Commit

Permalink
Added more about JS injection when doing SSR rehydration
Browse files Browse the repository at this point in the history
  • Loading branch information
deamme committed Sep 2, 2018
1 parent 1388023 commit 723fde1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ On the server: Instead of doing `store.getState()` you will just use `getGlobalS

On the client: Instead of doing `createStore(counterApp, preloadedState)` you can do `replaceGlobalState(preloadedState)`

Keep in mind that trying to do SSR rehydration can introduce JS injections if you don't do it right.

The Redux guide solves it by doing `JSON.stringify(preloadedState).replace(/</g, '\\u003c')`. For another solution look [here](https://github.com/deamme/laco/pull/2#issuecomment-417880218).

## Testing
Testing using [tape](https://github.com/substack/tape):
Expand Down

0 comments on commit 723fde1

Please sign in to comment.