From bf75dfcc679220608820c267aa3886790e4c41d4 Mon Sep 17 00:00:00 2001 From: Shaurya Arora Date: Thu, 10 Sep 2015 13:06:14 -0500 Subject: [PATCH] Update installation code snippet on README.md page --- README.md | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d0c6c0e03b2824..2ea44885a957c9 100644 --- a/README.md +++ b/README.md @@ -67,26 +67,34 @@ 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 ( ); @@ -94,6 +102,7 @@ let MyAwesomeReactComponent = React.createClass({ }); + module.exports = MyAwesomeReactComponent; ```