3 ms·
The main use case highlighted in the article is React and that is the use case that I am speaking to. With React, you don't modify the DOM directly, so the use
by rajangdavis 5y ago
The main use case highlighted in the article is React and that is the use case that I am speaking to.
With React, you don't modify the DOM directly, so the use case you have laid out is not applicable.
With that in mind, you are still free to use the CSS custom property with React, but if you want to have multiple transformations across multiple parts of an application, it's a lot simpler to use CSS-in-JS to generate styling based on state.
The use case you have brought up should work well with vanilla js/jquery; however, the context of the discussion is rooted in front-end libraries and the popularity of CSS-in-JS, so I am not sure how custom properties are relevant.