Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@ybiquitous/use-toggle

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ybiquitous/use-toggle

React useToggle() utility

Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

useToggle()

npm

React useToggle() utility.

  • React 16+
  • No dependencies
  • TypeScript support

Install

npm install @ybiquitous/use-toggle

Usage

import useToggle from "@ybiquitous/use-toggle";

function App() {
  const [checked, check, uncheck, toggle] = useToggle();

  return (
    <p>
      <input type="checkbox" checked={checked} />
      <button onClick={check}>Check</button>
      <button onClick={uncheck}>Uncheck</button>
      <button onClick={() => toggle()}>Toggle</button>
      <button onClick={() => toggle(true)}>Toggle with boolean</button>
    </p>
  );
}

See also the online demo!

Keywords

react

FAQs

Package last updated on 16 Apr 2021

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