function Task( {task , deleteTask , onToggle}) {
return (
<div className='task' onDoubleClick={()=>onToggle(task.id)}>
<h3>{task.text}
<FaTimes style= {{color:'red' , cursor:'pointer'}}
onClick={()=>deleteTask(task.id)}/>
</h3>
<p>{task.day}</p>
</div>
)
}
export default Task
Asked
Active
Viewed 354 times
0

Samathingamajig
- 11,839
- 3
- 12
- 34
-
3Does this answer your question? [onClick works but onDoubleClick is ignored on React component](https://stackoverflow.com/questions/25777826/onclick-works-but-ondoubleclick-is-ignored-on-react-component) – MhkAsif Dec 19 '21 at 04:23
-
@MhkAsif that was for a single DOM element. here, the events are on different elements. Check this one out, [codesandbox link](https://codesandbox.io/s/bold-morning-trbie). this one works – Shivam Jha Dec 19 '21 at 04:25
-
yap, I also could make it works, here [sample](https://codesandbox.io/s/little-dawn-uqz9z?file=/src/App.js) – Akza Dec 19 '21 at 04:26
-
can you put your code in codesandbox as it's working on my app – MhkAsif Dec 19 '21 at 04:29
-
onDoubleClick={()=>console.log("double clicked")} check if it is giving result in console or not – MhkAsif Dec 19 '21 at 04:31
1 Answers
0
I had the same issue. I suspected the double click is not working properly when the development tool is opened. So I changed console.log() into alert() and closed the inspector. It works for me.

yugdr
- 25
- 5