loading code fetching the highlighted snippet
whileHover and whileTap are temporary animation states that blend in while a pointer is over (or pressing) the element. Release returns to the resting state automatically.
whileHover takes effect when the pointer enters the element and lifts
back to animate when it leaves. Here it scales the square to 1.2x — a lift-and-grow
common to clickable cards.whileTap overrides whileHover while the pointer (or touch) is
held down — scale 0.8 reads as a press. Release re-applies hover until the pointer leaves.$state flag, no event handlers. Same idea works for opacity, rotation, colour,
or any animatable prop.