Skip to content

Commit

Permalink
Update installation code snippet on README.md page
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaurya Arora authored and Shaurya Arora committed Sep 10, 2015
1 parent 0fb52fd commit bf75dfc
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,42 @@ Material-UI was designed with the [Roboto](http://www.google.com/fonts/specimen/

Once material-ui is included in your project, you can use the components this way:
```js
/** MyAwesomeReactComponent.jsx */
// get constant references to React and Material-UI
// components, as we will not be modifying these

let React = require('react'),
mui = require('material-ui'),
ThemeManager = new mui.Styles.ThemeManager(),
RaisedButton = mui.RaisedButton;
const React = require(\'react\');
let MyAwesomeReactComponent = React.createClass({
// it is good practice to require only those components of
// Material-UI that your app needs, instead of requiring all of
// Material-UI. This will make your build process faster and
// your build output smaller
const RaisedButton = require(\'material-ui/lib/raised-button\');
// see node_modules/material-ui/lib/index.js for a mapping of
// Material-UI components to require() calls
const MyAwesomeReactComponent = React.createClass({
childContextTypes: {
muiTheme: React.PropTypes.object
},
getChildContext: function() {
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
muiTheme: ThemeManager.getCurrentTheme()\
};
},
render: function() {
render() {
return (
<RaisedButton label="Default" />
);
}
});
module.exports = MyAwesomeReactComponent;
```
Expand Down

0 comments on commit bf75dfc

Please sign in to comment.