Created
March 25, 2020 18:54
-
-
Save cecigarcia/3f09deeb796f7ed96f0dbc99eea68e8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import useClickPrevention from "./use-click-prevention"; | |
const MyComponent = () => { | |
const onClick = () => console.log("single click"); | |
const onDoubleClick = () => console.log("double click"); | |
const [onClickWithPrevention, onDoubleClickWithPrevention] = useClickPrevention({ onClick, onDoubleClick }); | |
return ( | |
<div | |
className="clickable-container" | |
onClick={onClickWithPrevention} | |
onDoubleClick={onDoubleClickWithPrevention} | |
/> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment