@loadsmart/utils-function

useful functions for handling functions

Usage no npm install needed!

<script type="module">
  import loadsmartUtilsFunction from 'https://cdn.skypack.dev/@loadsmart/utils-function';
</script>

README

utils-function

useful functions for handling functions.

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>
  )
}