0.2.3 • Published 2 years ago

@andrewizbatista/use-bool v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

useBool

A simple React hook that encapsulates the logic around a boolean value with ZERO dependencies.

Created by♥ @andrewizbatista

Table of Contents

Getting Started

Prerequisites

This package has peerDependencies that are required for you to include in your app's dependencies:

{
  "dependencies": {
    "react": "^17.0.2"
  }
}

Installing

yarn

yarn add @andrewizbatista/use-bool

npm

npm install @andrewizbatista/use-bool

Usage

Use it as you would use any other React hook.

import { useBool } from '@andrewizbatista/use-bool';

function Usage() {

  // Normal usage
  const { bool, toTrue, toFalse, toggle } = useBool(false);

  // Tip: In ES6 you can rename your object keys!
  const {
    bool: open,
    toTrue: openModal,
    toFalse: closeModal,
    toggle: toggleModal,
  } = useBool(false);

  return (
    ...
  )
}

Contributing

Want to help? Feel free to open an Issue or create a Pull Request and let's get started 🚀

License

MIT © André Batista (@andrewizbatista) 🎉

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

3 years ago