DEV Community

Discussion on: Styled Web Components

Collapse
 
ashubham profile image
Ashish Shubham

Well, if the instances share the same styles, how are you able to reactively change the styles based on props ? The styles for all instances would change based on props passed to a single instance ?

Thread Thread
 
alfredosalzillo profile image
Alfredo Salzillo

An unique class name, based on the style, is created and added to the element every time props changes. The old class name if present is removed.
Take a look at the code.