M
M
MRcracker2021-10-09 11:49:48
React
MRcracker, 2021-10-09 11:49:48

How to correctly specify classes when using module.css?

When using module css, you need to add styles to the class, but what if I use hooks?
For example, there is a code. How can I use the modal, active classes with the module.css approach (styles.modal and styles.active) or nothing can be done in this case and I have to put the classes in the global css file?
className={active ? "modal active" : "modal"}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2021-10-09
@serbananas

className={active ? styles.modal + ` ` + styles.active : styles.modal}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question