Created
July 15, 2015 17:47
-
-
Save tmbtech/f66e210181b23983f9f5 to your computer and use it in GitHub Desktop.
Create Element with static methods
This file contains hidden or 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
<Router routes={routes} | |
history={new BrowserHistory()} | |
createElement={(Component, props) => { | |
if (Component.fetchData) { | |
dataFetchers[ Component.displayName ] = Component.fetchData.bind(Component, flux, props); | |
clearTimeout(dataFetcherTimeout); | |
dataFetcherTimeout = setTimeout(() => { | |
Object.keys(dataFetchers).forEach(displayName => dataFetchers[ displayName ]()); | |
dataFetchers = {}; | |
}, 10); | |
} | |
return <Component flux={flux} {...props}/>; | |
}} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment