Answer the question
In order to leave comments, you need to log in
How to make proper interaction between jsx and React.js?
I started to study React, where javascript is actively used in the jsx format. For its transformation, Galpov's gulp-jsx package began to be used, which converts the jsx format into understandable js.
As a result, the line
<h1 onClick={this.goodbye}>{this.state.message}</h1>
React.DOM('h1', {onClick: this.goodbye}, [this.state.message])
React.DOM.h1({onClick:this.goodbye}, this.state.message));
works fine. Answer the question
In order to leave comments, you need to log in
And how and where do you then connect the template compiled from jsx?
In theory, if you do not use the real-time JSX Transformer, but use precompilation on the server using react-tools, then you just need to include the compiled file at the end of body
....
<script src="build/from_jsx.js"></script>
</body>
</html>
<script type="text/jsx">
...
render: function() {
return (
<h1 onClick={this.goodbye}>{this.state.message}</h1>
);
}
...
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question