Skip to content

Commit

Permalink
fix [object Object] 2
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Jun 30, 2017
1 parent 783d60f commit aac97e8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
46 changes: 36 additions & 10 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
// import React from 'react'
// import {Provider} from 'react-redux'
// import createStore from './src/createStore'
//
// const store = createStore()
//
// exports.wrapRootComponent = function wrapRootComponent({Root}) {
// return function wrapRootComponentComponent(props) {
// return (
// <Provider store={store}>
// <Root />
// </Provider>
// )
// }
// }
//
//
//
//
//
//
//
//

import React from 'react'
import {Provider} from 'react-redux'
import { BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'

import createStore from './src/createStore'

const store = createStore()
exports.replaceRouterComponent = ({ history }) => {
const store = createStore()

const ConnectedRouterWrapper = ({ children }) => (
<Provider store={store}>
<Router history={history}>{children}</Router>
</Provider>
)

exports.wrapRootComponent = function wrapRootComponent({Root}) {
return function wrapRootComponentComponent(props) {
return (
<Provider store={store}>
<Root />
</Provider>
)
}
return ConnectedRouterWrapper
}
3 changes: 3 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ exports.modifyWebpackConfig = function modifyWebpackConfig({config, stage}) {
atob: function atob(str) {
return new Buffer(str, 'base64').toString('binary');
},
location: {
pathname: ''
}
}
})
}
Expand Down
4 changes: 3 additions & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react'
import { Provider } from 'react-redux'
import { renderToString } from "react-dom/server"


import createStore from './src/createStore'

Expand All @@ -12,5 +14,5 @@ exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
{bodyComponent}
</Provider>
)
replaceBodyHTMLString(<ConnectedBody/>)
replaceBodyHTMLString(renderToString(<ConnectedBody/>))
}
2 changes: 1 addition & 1 deletion src/templates/Tutorials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Tutorials extends React.Component<Props, null> {
nextChapter={nextChapter}
n={n + 1}
showBonus={showBonus}
path={location.pathname}
path={this.props.location.pathname}
/>}
</div>
</div>
Expand Down

0 comments on commit aac97e8

Please sign in to comment.