L
L
lil_web2020-12-25 00:49:29
Ad blocking
lil_web, 2020-12-25 00:49:29

How to hash classes in a React app?

The site is based on React, the site has its own advertising image. I wrapped it in a div with a BEM class: .Sidebar-Ad. The customer says that according to my class it is easy to add a banner to the ad blocker.

I looked at different options: css-modules with a class of type classname_hash, styled-components with a class from a pure hash, and the styles attribute. In any case, advertising is easy to hide.

But you can make a simple defense. I came up with the idea of ​​creating a separate css file, which, once in a while, is regenerated with new hash classes. For implementation, I will make ejecta starter create-react-app, I will separately collect the css file on Webpack and make hashes with the loader.

Please tell us about your experience of dealing with the ad-block and how do you like my decision.

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