Created
July 30, 2016 10:02
-
-
Save navgarcha/ac77b7d9d350e9cd3da594b8c7e252f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function requestContextData(store = {}, { components = [] }) { | |
const promises = components.reduce((prev, current = {}) => { | |
return (current.need || []).concat(prev); | |
}, []).map((need) => store.dispatch(need())); | |
return Promise.all(promises); | |
} | |
// ... | |
requestContextData(store, props).then(() => { | |
const state = store.getState(); | |
const html = renderToString(rootComponent); | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment