T
T
testtostertest1112019-01-08 17:35:18
JavaScript
testtostertest111, 2019-01-08 17:35:18

How to add a class depending on a condition in react?

There is a variable that can be true or false, you need to add a class depending on this variable or not.
Tried like this, className={{[myClass]: isRender}} doesn't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alexandrovich, 2019-01-08
@testtostertest111

className={isRender?"myClass":null}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question