Last active
September 15, 2016 08:36
-
-
Save mijia/5ad6f9f53a2e85b1de2c to your computer and use it in GitHub Desktop.
Hook up the mdl componentHandler with React Router
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
let MDLUpgrade = function(Component) { | |
const MDLComponent = React.createClass({ | |
componentDidUpdate() { | |
componentHandler.upgradeDom(); | |
}, | |
render() { | |
return <Component {...this.props} />; | |
}, | |
}); | |
return MDLComponent; | |
}; | |
let routes = ( | |
<Route handler={SomeApp}> | |
<Route name="home" path="/" handler={MDLUpgrade(HomePage)} /> | |
</Route> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just wanted to say thanks for this! Exactly what I needed.