# @anmolm/react-use-checkbox

> React Hook for toggling state of a checkbox

Latest version **1.0.0** (published 2018-12-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @anmolm/react-use-checkbox
pnpm add @anmolm/react-use-checkbox
yarn add @anmolm/react-use-checkbox
bun add @anmolm/react-use-checkbox
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-12-28 |
| First published | 2018-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Anmol Maini |
| Maintainers | anmolm |
| Keywords | react, hooks, checkbox, javascript |

## Links

- npm: https://www.npmjs.com/package/@anmolm/react-use-checkbox
- Repository: https://github.com/anmolm96/react-use-checkbox
- Homepage: https://github.com/anmolm96/react-use-checkbox#readme
- Issues: https://github.com/anmolm96/react-use-checkbox/issues
- npm.io page: https://npm.io/package/@anmolm/react-use-checkbox

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-12-28
- 0.0.6 — 2018-12-28
- 0.0.5 — 2018-12-28
- 0.0.4 — 2018-12-28
- 0.0.3 — 2018-12-28
- 0.0.2 — 2018-12-28
- 0.0.1 — 2018-12-28

## README

## react-use-checkbox

[![](https://img.shields.io/npm/v/@anmolm/react-use-checkbox.svg)](https://github.com/anmolm96/react-use-checkbox) [![](https://img.shields.io/bundlephobia/min/@anmolm/react-use-checkbox.svg)](https://github.com/anmolm96/react-use-checkbox)

> ⚠️ Warning: Hooks are still in alpha, so only use this for experiments

### About
`react-use-checkbox` is a custom React Hook to use for toggling the state of a Checkbox input.
It was inspired by [hooks.guide](https://www.hooks.guide)

### Install
NOTE: You need to have React 16.7.0-alpha.2 or later installed to use React Hooks (and this package).

```bash
    yarn add @anmolm/react-use-checkbox
```

### Usage

**useCheckbox**: This is a hook that lets you toggle the value of an input of type `checkbox`.
You can pass an initial value of `true` if you wanted the checkbox to be selected, otherwise it defaults to `false`.

```jsx
import React from 'react';
import { useCheckbox } from '@anmolm/react-use-checkbox';

const App = () => {
    const [checked, setChecked] = useCheckbox();
    return (
        <>
            <input
                type="checkbox"
                checked={checked}
                onChange={setChecked}
            /> Checkbox
        </>
    );
}
```

### License

MIT

---
_Source: https://npm.io/package/@anmolm/react-use-checkbox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
