'Hover work when i turn on devtools but dont work when i turn off devtools?
when i hover to image when devtools not turn on, it dont working but when i open when devtools and hover again. It finally work ?? I have been trying in difference browser but the same problem is happened, everyone help me solved this. It was happened when i used setTimeout and clearTimeout in difference function, it would be nice if you can help solved this or idea of write code in difference ways.
const handleHover = () => {
//set time out here
setHandleDelay(setTimeout(() => {
setHover(true)
}, 1000 ))
}
const handleNotHover = () => {
//i want to clear time out here when it not hover
clearTimeout(handleDelay)
setHover(false)
}
return (
<div key={movie.id}
onMouseOver={() => handleHover()}
onmouseover{() => handleNotHover()}>
<div>...</div>
)
Solution 1:[1]
Thank for everyone i have already fine the solution. It is stupid of me for mistake at event onMouseOver and onMouseEnter.
It was better to use onMouseEnter and onMouseLeave when you hover on element in Reactjs
<div
onMouseEnter={() => handleHover()}
onMouseLeave={() => handleNotHover()} />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
