Answer the question
In order to leave comments, you need to log in
How to use react without JSX?
This code throws an error
var LikeButton = React.createClass({
getInitialState: function() {
return {liked: false};
},
handleClick: function(event) {
this.setState({liked: !this.state.liked});
},
render: function() {
var text = this.state.liked ? 'like' : 'have not liked';
return (
React.createElement('p', null, 'You {text} this. Click to toggle.')
);
}
});
ReactDOM.render(
LikeButton,
document.getElementById('content')
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question