R
R
Remorses2014-11-28 18:46:59
RequireJS
Remorses, 2014-11-28 18:46:59

How to compile jsx?

All greetings
Faced small difficulties.
I decided to use elements of the material ui framework material-ui.com on the site I installed it via npm + browserify and reactify.
I created a main.js file and put the code from the material ui site into it

/**
 * @jsx React.DOM
*/

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

var SomeAwesomeComponent = React.createClass({

  render: function() {
    return (
        <PaperButton type={PaperButton.Types.FLAT} label="Default" />
    );
  }

});

module.exports = SomeAwesomeComponent;

Then you need to convert from the jsx format to js and it doesn’t work for me (
I tried the commands browserify js/main.js -o js/done.js -d does not help, writes
https://www.dropbox.com/s/4zn69oj4r0rsfij/ %D0%A1%D...
Help with this please
Thank you

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Remorses, 2014-11-28
@Remorses

Even with its use, it displays an error, the problem is with line 13

P
Pavel Kilin, 2015-01-03
@borodyadka

There is a react-tools package , it contains a JSX compiler to regular JS.
More about the package.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question