Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
export function preventDefault (func, ...args) {
return e => {
e.preventDefault()
func(...args)
}
}
export function targetValue (func, ...args) {
return e => {
func(e.target.value, ...args)
}
}
export function targetValueNumber (func, ...args) {
return e => {
func(Number(e.target.value), ...args)
}
}
// usage
<a href='#add' onClick={preventDefault(handleAdd)} >add item</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.