Comment on Create a character voting app using React, Node.js, MongoDB and Socket.ioparentComments−kentor11yHere's how I would inline it, and I encourage people to do it this way. Intermediate variable is not necessary. Ternary is not necessary since false evaluates to null in jsx. render() { return ( <div className='card'> {this.props.delta > 0 && <strong className={this.props.delta > 0 ? 'text-success' : 'text-danger'}> {this.props.delta} </strong> } {this.props.title} </div> ); }
Comments
Here's how I would inline it, and I encourage people to do it this way. Intermediate variable is not necessary. Ternary is not necessary since false evaluates to null in jsx.