You can do things with CSS variables that are not possible with JS.
Josh breaks down why and how you can use CSS variables more easily in React, specifically using styled-components. Honestly it feels a little terrifying how much is needed just to get basic browser functionality to work...