1.0.2 • Published 6 years ago

@flaque/use-toggle v1.0.2

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

use-toggle License

Like useState, but for toggling something on/off.

Install

yarn add @flaque/use-toggle

Usage

import useToggle from '@flaque/use-toggle'

function MySwitch() {
    const [isOn, toggleIsOn] = useToggle(true)

    return (<>
        <p>{`I am ${isOn ? "on" : "off"}`}</p>

        <button onClick={toggleIsOn}>
    </>)
}
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago