Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JSX version of LikeButton
'use strict';
class LikeButton extends React.Component {
constructor(props) {
super(props);
this.state = { liked: false };
}
render() {
if (this.state.liked) {
return 'You liked this.';
}
return (
<button onClick={() => this.setState({ liked: true }) }>
Like
</button>
);
}
}
let domContainer = document.querySelector('#like_button_container');
ReactDOM.render(<LikeButton />, domContainer);
@PhuruShekar

This comment has been minimized.

Copy link

@PhuruShekar PhuruShekar commented Aug 6, 2019

What changes would we have to make to the index.html file and the buttons we are making to use JSX?

@tamlylyi

This comment has been minimized.

Copy link

@tamlylyi tamlylyi commented Sep 28, 2019

  • [ ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.