Socket
Book a DemoInstallSign in
Socket

@flaque/use-toggle

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flaque/use-toggle

A simple switch hook

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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}>
    </>)
}

FAQs

Package last updated on 01 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts