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 (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-17T21:02:07.000Z (over 4 years ago)
- Last Synced: 2025-05-20T12:56:47.839Z (about 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
[](https://github.com/nickfla1/react-use-safe-state/main/LICENSE)
[](https://github.com/nickfla1/react-use-safe-state/releases/)
[](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`.