G
G
gomerIT2020-12-16 22:41:11
React
gomerIT, 2020-12-16 22:41:11

ReactJS how to apply one css class with different styles for different pages?

I have several pages in my applications, all set up with routing. There are also cards with goods of 3 types and all have different styles. I would like to use a single class for all products

.product-card
and there is already a BAM (.product-card__photo, .product-card__title ...), but React will not allow me to do this because I have a SPA and the styles will interrupt each other. Are there any solutions to this problem except "come up with an individual class for each product"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Makarov, 2020-12-17
@kirbi1996

Firstly, in react className
Secondly, nothing should interrupt each other, create a file, example.css, import it where you need it, in any component or page, and you can already apply this className in this component. As well as an option, you can connect all this through index.css, but then if I'm not mistaken, you need scss, and import

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question