Created
November 29, 2023 15:12
-
-
Save leontastic/32a8366de4d51d5c98dd54a0bb7ee959 to your computer and use it in GitHub Desktop.
helpful utility to handle `event.preventDefault` in react
This file contains hidden or 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'; | |
export const preventDefault = ( | |
handler: React.EventHandler<React.SyntheticEvent>, | |
): React.EventHandler<React.SyntheticEvent> => (event) => { | |
event.preventDefault(); | |
handler(event); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment