4 ms·
How is this implemented? And how is the :hover pseudo class implemented? Awesome work by the way!
by hkeide 10y ago
How is this implemented? And how is the :hover pseudo class implemented? Awesome work by the way!
- mxstbr 10y agoIt isn't "implemented" – it's just CSS! Literally! (Note: Almost the sole thing we do to that CSS before injecting it into the DOM is adding a hash of the contents as the selector. Not sure if that counts as "implemented"?)
- hkeide 10y agoThank you, that's what I wanted to know, since projects like Radium implement e.g. hover in JS using onMouseEnter() etc, which sounds slow. See https://github.com/FormidableLabs/radium#how-does-radium-work https://github.com/FormidableLabs/radium#how-does-radium-wor...
- mxstbr 10y agoExactly, they use inline styles, we use CSS. :) (that's the difference between _inline styles_ (<p style={styles} />) and CSS-in-JS (<p className={styles} />) libs)
- hkeide 10y agoI don't think everyone uses that distinction, see this list for example. Radium is included among others: https://github.com/MicheleBertoli/css-in-js https://github.com/MicheleBertoli/css-in-js Or this influential talk: https://speakerdeck.com/vjeux/react-css-in-js https://speakerdeck.com/vjeux/react-css-in-js
- mxstbr 10y agoI very much realize that, which is why I've been pushing towards people recognizing this because it _does_ make a huge difference! (as seen by the OC that kicked off this discussion)