Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nickfla1/react-use-safe-state
https://github.com/nickfla1/react-use-safe-state
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/nickfla1/react-use-safe-state
- Owner: nickfla1
- License: mit
- Created: 2021-02-12T21:28:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-17T21:02:07.000Z (almost 4 years ago)
- Last Synced: 2024-10-14T02:26:35.098Z (2 months ago)
- Language: TypeScript
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# use-safe-state
[![GitHub license](https://img.shields.io/github/license/nickfla1/react-use-safe-state.svg)](https://github.com/nickfla1/react-use-safe-state/main/LICENSE)
[![GitHub release](https://img.shields.io/github/release/nickfla1/react-use-safe-state.svg)](https://github.com/nickfla1/react-use-safe-state/releases/)
[![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)`use-safe-state` is an utility hook that wraps around react's `useState` with the aim to prevent the occuring of the famous `Can't perform a React state update on an unmounted component` error.
### Installation
```sh
# Yarn
yarn add use-safe-state# NPM
npm install use-safe-state --save
```### Usage
Using `use-safe-state` is as simple as replacing `useState` hooks with `useSafeState`.