@loadsmart/utils-function
v0.3.1
Published
useful functions for handling functions
Downloads
507
Maintainers
Keywords
Readme
utils-function
useful functions for handling
function
s.
Install via NPM
$ npm i @loadsmart/utils-function --save
Install via yarn
$ yarn add @loadsmart/utils-function
Usage
import React from 'react'
import { isFunction } from '@loadsmart/utils-function'
export default ({ onClick }) => {
const onClickHandler = isFunction(onClick) ? onClick : null
return (
<button type="button" onClick={onClickHandler}>
Do something
</button>
)
}