# @charlietango/use-toggle

> Simple boolean state toggler

Latest version **1.4.0** (published 2022-04-14) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @charlietango/use-toggle
pnpm add @charlietango/use-toggle
yarn add @charlietango/use-toggle
bun add @charlietango/use-toggle
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2022-04-14 |
| First published | 2019-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 81 |
| Maintainers | thebuilder, frederik_bosch |
| Keywords | react, hooks |

## Links

- npm: https://www.npmjs.com/package/@charlietango/use-toggle
- Repository: https://github.com/charlie-tango/hooks
- Homepage: https://github.com/charlie-tango/hooks#readme
- Issues: https://github.com/charlie-tango/hooks/issues
- npm.io page: https://npm.io/package/@charlietango/use-toggle

## 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.4.0 (latest) — 2022-04-14
- 1.3.0 — 2020-10-19
- 1.2.6 — 2020-09-23
- 1.2.5 — 2020-06-09
- 1.2.4 — 2019-11-13
- 1.2.3 — 2019-09-25
- 1.2.2 — 2019-06-28
- 1.2.1 — 2019-03-12
- 1.2.0 — 2019-03-08

## README

# useToggle

Simple boolean state toggler

> Checkout the [Storybook](https://ct-hooks.now.sh/?path=/story/usetoggle--readme) demo.

## Installation

```sh
yarn add @charlietango/use-toggle
```

## API

```js
const toggledInitially = false
const [isToggled, toggle] = useToggle(toggledInitially)
```

## Example

```jsx
import React from 'react'
import useToggle from '@charlietango/use-toggle'

const Component = () => {
  const [isToggled, toggle] = useToggle(true)
  return <button onClick={toggle}>{isToggled}</button>
}

export default Component
```

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