Attempting to create a simple like/unlike component with React. How can I render this component with <i class="fal fa-thumbs-down"> markup and classes to style the icons? My syntax here is off somewhere.
class LikeButton extends React.Component {
constructor(props) {
super(props);
this.state = { liked: false };
}
render() {
if (this.state.liked) {
return (
<i class="fal fa-thumbs-down"></i>
{ onClick: () => this.setState({ liked: false }) }
);
}
return (
<i class="fal fa-thumbs-up"></i>
{ onClick: () => this.setState({ liked: true }) }
);
}
}