How do you Hover in ReactJS? - onMouseLeave not registered during fast hover over

前端 未结 13 2264
旧时难觅i
旧时难觅i 2020-11-28 04:23

How can you achieve either a hover event or active event in ReactJS when you do inline styling?

I\'ve found that the onMouseEnter, onMouseLeave approach is buggy, so

13条回答
  •  Happy的楠姐
    2020-11-28 04:35

    I'd use onMouseOver & onMouseOut. Cause in React

    The onMouseEnter and onMouseLeave events propagate from the element being left to the one being entered instead of ordinary bubbling and do not have a capture phase.

    Here it is in the React documentation for mouse events.

提交回复
热议问题