Skip to content

Commit ca551ba

Browse files
authored
serialize data on client
1 parent 14f4197 commit ca551ba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/browser-router.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import Router, { initParams, initResult } from './router';
33
import { Context, stringifyQuery } from 'router-async';
4+
import * as serialize from 'serialize-javascript';
45

56
export default class BrowserRouter extends Router {
67
private history: any;
@@ -113,7 +114,7 @@ export default class BrowserRouter extends Router {
113114
const props = {
114115
id : '__react-router-async',
115116
dangerouslySetInnerHTML: {
116-
__html: `window.__REACT_ROUTER_ASYNC__=${JSON.stringify({ state: this.stateFromServer })};`
117+
__html: `window.__REACT_ROUTER_ASYNC__=${serialize({ state: this.stateFromServer }, { isJSON: true })};`
117118
}
118119
};
119120

0 commit comments

Comments
 (0)