Commit 73b8cb0026f46f9832397193b25b38399404be17
fix app/utils/fetch-element
Michael Williams committed on 1/8/2016, 5:33:25 AMParent: 9a58b75ae70cb562daad4d67cfa777ae8aa48459
Files changed
app/render-browser.js | changed |
app/util/fetch-element.js | changed |
app/render-browser.js | ||
---|---|---|
@@ -18,9 +18,9 @@ | ||
18 | 18 | |
19 | 19 | syncReduxAndRouter(history, store) |
20 | 20 | |
21 | 21 | const main = ( |
22 | - <Router createElement={fetchElement} history={history}> | |
22 | + <Router createElement={fetchElement(store)} history={history}> | |
23 | 23 | { routes } |
24 | 24 | </Router> |
25 | 25 | ) |
26 | 26 |
app/util/fetch-element.js | ||
---|---|---|
@@ -1,12 +1,13 @@ | ||
1 | 1 | import React from 'react' |
2 | 2 | |
3 | -export default function fetchElement (Component, props) { | |
4 | - if (Component.fetchData) { | |
5 | - Component.fetchData( | |
6 | - store.getState, store.dispatch, | |
7 | - props.location, props.params | |
8 | - ) | |
3 | +export default function fetchElement (store) { | |
4 | + return function (Component, props) { | |
5 | + if (Component.fetchData) { | |
6 | + Component.fetchData( | |
7 | + store.getState, store.dispatch, | |
8 | + props.location, props.params | |
9 | + ) | |
10 | + } | |
11 | + return React.createElement(Component, props) | |
9 | 12 | } |
10 | - return React.createElement(Component, props) | |
11 | 13 | } |
12 | - |
Built with git-ssb-web