It's good to ask yourself why do you want to avoid duplication in the first place?
The value of avoiding duplication is during development - it helps you keep code clean and avoid bugs by having to change things in more than one place.
Is your code already without duplication inside the component classes? If yes, there should be no problem that at runtime the styles are applied over and over again to each <div>, since the browser knows how to handle these things very well.
In the StackOverflow question you are also asking:
is there a way to generate a class name "on demand" and apply it to the rendered component?
I don't think there is a way out of the box, but you could use for instance styled-components which does this for you out of the box. Version 2 of the library has only 12kb (medium.com/styled-components/announcing-v2-f01ef3…).