Skip to content

Instantly share code, notes, and snippets.

@mijia
Last active September 15, 2016 08:36
Show Gist options
  • Save mijia/5ad6f9f53a2e85b1de2c to your computer and use it in GitHub Desktop.
Save mijia/5ad6f9f53a2e85b1de2c to your computer and use it in GitHub Desktop.
Hook up the mdl componentHandler with React Router
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>
);
@ncksllvn
Copy link

Just wanted to say thanks for this! Exactly what I needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment