While working on the project at work, I was told to implement below JS code in CSS class rather than JS function:
function onMouseOver(e : any) {
e.target.style.textDecoration = 'underline';
}
function onMouseLeave(e : any) {
e.target.style.textDecoration = 'none';
}
What is the trade-off between two of them and why one of them should be preferred over another.
Short: why shouldn't I create mouseOver class in React but use CSS class? Does it take long time to implement JS function over CSS hover?
hoverpseudo-class instead of using Javascript.