`How to write a logical operator?
S
S
StrangeGoogle2019-12-27 09:21:45
JavaScript
StrangeGoogle, 2019-12-27 09:21:45

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

1 answer(s)
D
Dmitry Sviridov, 2019-12-27
@StrangeGoogle

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 question

Ask a Question

731 491 924 answers to any question