1.4.0 • Published 2 years ago

@charlietango/use-toggle v1.4.0

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

useToggle

Simple boolean state toggler

Checkout the Storybook demo.

Installation

yarn add @charlietango/use-toggle

API

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

Example

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
1.4.0

2 years ago

1.3.0

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago