1.0.0 • Published 3 years ago

@erslee/use-toggle v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

React use toggle hook

Getting started

Install the latest version:

npm install --save npm i @erslee/use-toggle
  or
yarn add @erslee/use-toggle

Use the hook in the component!

import React from 'react';
import useToggle from '@erslee/use-toggle';

const Component = () => (
  const [value, toggleValue] = useToggle(true);

  return (
    <div className="App">
      <p>{value}</p>
      <button onClick={toggleValue}>toggle value</button>
    </div>
  );
);
1.0.0

3 years ago