Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

aldrinpvincent/useSafeState

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Archiving this repository

Archiving this repository because - reactwg/react-18#82

Also this hook is availble in the new project, along with a bunch of other useful custom hooks. Please checkout https://github.com/aldrinpvincent/react-use-custom-hooks

Documentation of this hook in new project - https://react-use-custom-hooks.vercel.app/docs/useSafeState

useSafeState

Hook to prevent setting state on unmounted component that prevents memory leaks that happens when setting state on unmounted components.

Installation

  npm i react-use-safe-state

Usage

Importing component

import useSafeState from "react-use-safe-state";

const [state, setState] = useSafeState(initalValue);

react-use-safe-state downloads per month

About

useSafeState React component

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published