1.0.2 • Published 5 years ago

@flaque/use-toggle v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 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

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago