Skip to content

Commit

Permalink
feat(Html): use serialize-javascript package
Browse files Browse the repository at this point in the history
  • Loading branch information
kiki-le-singe committed Jan 8, 2017
1 parent e42fbdf commit 053416e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server/components/Html/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component, PropTypes } from 'react'
import { renderToString } from 'react-dom/server'
import Helmet from 'react-helmet'
import serialize from 'serialize-javascript'

export default class Html extends Component {
static propTypes = {
Expand Down Expand Up @@ -60,7 +61,7 @@ export default class Html extends Component {

<body>
<div id="root" dangerouslySetInnerHTML={{ __html: renderToString(component) }} />
<script dangerouslySetInnerHTML={{ __html: `window.__PRELOADED_STATE__=${JSON.stringify(store.getState())};` }} />
<script dangerouslySetInnerHTML={{ __html: `window.__PRELOADED_STATE__=${serialize(store.getState())};` }} />
{this.scripts}
</body>
</html>
Expand Down

0 comments on commit 053416e

Please sign in to comment.