08-19-2021, 06:39 PM
(This post was last modified: 08-19-2021, 06:39 PM by remkonoteboom.)
I just looked at the program I listed above and it doesn't use JSX at all. I copied the output which is pure javascript and not dependent on any JSX processor. I am not sure why that javascript wouldn't run unless the React.js files didn't load.
This is the javascript using JSX
This is the javascript using JSX
Code:
class LikeButton extends React.Component {
constructor(props) {
super(props);
this.state = { liked: false };
}
button_press = () => {
this.setState( {liked: true} )
}
render() {
if (this.state.liked) {
return 'You liked this.';
}
return (
<div class="button" onClick={ () => {this.button_press() } }
className="btn btn-primary">Like</div>
);
}
}
ReactDOM.render(React.createElement(LikeButton), bvr.src_el);