cosmo-ui
Version:
Common React components
20 lines (16 loc) • 531 B
text/typescript
import * as React from 'react'
export const mkNonPropagatingClick = (clickHandler: () => any) =>
(e: React.MouseEvent<any>) => {
e.stopPropagation()
clickHandler()
}
export const prevDef = (handler: (e: React.SyntheticEvent<any>) => any) =>
(e: React.SyntheticEvent<any>) => {
e.preventDefault()
handler(e)
}
export const eventValue = (handler: (v: string) => any) =>
(e: React.SyntheticEvent<any>) => {
e.preventDefault()
handler(e.currentTarget.value)
}