score:1

Accepted answer

.style only tells you the inline style on the element, and this div has no inline style. if you want to know the style that results when combining inline style and css selectors, you need getcomputedstyle

const handleclick = () => {
  console.log(window.getcomputedstyle(r.current).backgroundcolor);
}

score:0

el.style.x is not working correctly. insteadof this use window.getcomputedstyle(el) and u can get full list of styles. as a example u can see it.


Related Query

More Query from same tag