Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/farwayer/react-use-bool
Simple React boolean hooks
https://github.com/farwayer/react-use-bool
Last synced: 4 days ago
JSON representation
Simple React boolean hooks
- Host: GitHub
- URL: https://github.com/farwayer/react-use-bool
- Owner: farwayer
- Created: 2020-03-22T15:39:15.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:47:26.000Z (almost 2 years ago)
- Last Synced: 2024-11-16T10:36:42.418Z (about 1 month ago)
- Language: JavaScript
- Size: 252 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## react-use-bool
_Simple React boolean hooks_
[![NPM version](https://img.shields.io/npm/v/react-use-bool.svg)](https://www.npmjs.com/package/react-use-bool)
## How to use
```bash
yarn add react-use-bool
``````js
import {useBool, useToggle} from 'react-use-bool'function Lamp() {
const [on, turnOn, turnOff] = useBool()return (
{on ? "ON" : "OFF"}
TURN ON
TURN OFF
)
}function ToggleLamp() {
const [on, toggle, setValue] = useToggle(true)return (
{on ? "ON" : "OFF"}
TOGGLE
setValue(false)}>OFF
)
}
```