Created
July 14, 2015 01:25
-
-
Save DarrenN/5c8e6df6eabb9632af74 to your computer and use it in GitHub Desktop.
Use Material Design Lite's JS to handle layouts with React + Webpack
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
/* jshint esnext:true */ | |
'use strict'; | |
import React from 'react'; | |
import Header from './header'; | |
import Workspace from './workspace'; | |
import Footer from './footer'; | |
// Manually call upgradeElement / MaterialLayout on the main layout div *AFTER* its been rendered in the DOM. | |
export default React.createClass({ | |
componentDidMount() { | |
let Material = require('exports?componentHandler&MaterialLayout!mdl'); | |
let layout = document.getElementById('layout'); | |
Material.componentHandler.upgradeElement(layout, 'MaterialLayout'); | |
}, | |
render() { | |
return( | |
<div id="layout" className="mdl-layout mdl-js-layout mdl-layout--fixed-header"> | |
<Header /> | |
<Workspace /> | |
<Footer /> | |
</div> | |
) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @DarrenN Can you share your webpack config?
I try to use getmdl with React but I can`t. I already post on Stackoverflow