Answer the question
In order to leave comments, you need to log in
`
How to write a logical operator?
let state = {fieldActive: false};
<div className={`form-textbox-label ${this.state.fieldActive <b><i>(Если true, то вернуть 'field-active') </i>'</b>field-active'}`}></div>
Answer the question
In order to leave comments, you need to log in
I advise you to put a convenient classnames library for these purposes . With it, similar constructions (and much more complex ones) look simpler:
const classNames = require('classnames');
...
<div className={classNames( "form-textbox-label", {
"field-active": this.state.fieldActive
})}></div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question