I am trying to toggle the Font Awesome icon by clicking on a to-do item. Here is the whole component ...
import React from 'react';
import './TodoItem.scss';
class TodoItem extends React.Component {
constructor(props) {
super(props);
this.state = {
complete: false
}
this.toggleComplete = this.toggleComplete.bind(this);
}
toggleComplete() {
this.setState(prevState => ({
complete: !prevState.complete
}));
}
render() {
const incompleteIcon = <span className="far fa-circle todo-item-icon"></span>;
const completeIcon = <span className="far fa-check-circle todo-item-icon"></span>;
return (
<div className="todo-item" onClick={this.toggleComplete}>
{this.state.complete ? completeIcon : incompleteIcon}
<span className="todo-item-text">{this.props.item}</span>
</div>
);
}
}
export default TodoItem;
Here is my FA 5 CDN (directly from the site) ...
<script defer src="https://use.fontawesome.com/releases/v5.0.1/js/all.js"></script>
I took some screenshots of the React dev tool and inspector ...
Here the React component is incomplete (default)

And while ...

And two iconic elements in the inspector, I noticed that the one that is not used by default is commented out.

, React, . , , , . Codepen, , , CD 4.7.0. Codepen FA 4.7.0, , HTML, SVG.
, FA 5, !
user8679481