M
M
Muvka2020-03-08 18:40:39
JavaScript
Muvka, 2020-03-08 18:40:39

How to write classes in JS to work with BEM blocks?

There are products on the project that look very different, but at the same time they have the same behavior logic - adding to the cart, changing the price when changing options, expanding a long description. And it seems logical to create one class for them, because duplicating logic is bad. But the problem is that the description, the add to cart button, etc. have different classes. It would be desirable to use date attributes, but it is wrong after all? The problem is that when expanding the description, you also need to add a class with a modifier. Help me to understand.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question