material ui Installation configure

眉间皱痕 提交于 2019-12-08 04:57:40

问题


USER MATERIAL ui

1.jsx

var React = require('react'),
  mui = require('material-ui'),
  RaisedButton = mui.RaisedButton;

var MyAwesomeReactComponent = React.createClass({

  render: function() {
    return (
      <RaisedButton label="Default" />
    );
  }

});

module.exports = MyAwesomeReactComponent;

browserify 1.jsx -o 1.js

Error: Parsing file C:\Users\wzx\AppData\Roaming\npm\1.jsx: Unexpected token (7:
11)
    at Deps.parseDeps 

unknow <RaisedButton label="Default" />

github :https://github.com/callemall/material-ui

1 npm install material-ui

2 Then how to do?

3 ...

4....

i what should i do next?

i need help, i have done a few days


回答1:


I got confused as well, but I worked it out after I searched around.

$ sudo npm install -g browserify
$ npm install --save-dev reactify

you now have all the dependencies, next you need the file, your example is:

var React = require('react'),
  mui = require('material-ui'),
  RaisedButton = mui.RaisedButton;

var MyAwesomeReactComponent = React.createClass({

  render: function() {
    return (
      <RaisedButton label="Default" />
    );
  }

});

module.exports = MyAwesomeReactComponent;

you then need run this command

$ browserify -t reactify <path to jsx file> -o <path to output location, including file name>

this will output the file, which will have everything you need!



来源:https://stackoverflow.com/questions/29045003/material-ui-installation-configure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!