-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Alternatively, you could use the ternary operator to help you simplify this:
playlistHero/src/components/Track/Track.js
Lines 14 to 20 in d05abe6
| renderAction(){ | |
| if (this.props.isRemoval) { | |
| return (<a className="Track-action" onClick={this.removeTrack}>-</a>); | |
| } else { | |
| return (<a className="Track-action" onClick={this.addTrack}>+</a>); | |
| } | |
| } |
to:
<a className="Track-action" onClick={this.props.isRemoval ? this.removeTrack : this.addTrack}>{this.props.isRemoval ? '-' : '+'}</a>This a element could be placed directly in your render() method so you could omit the renderAction() method as well!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels