@selfcommunity/react-core
Version:
React Core Components useful for integrating UI Community components (react-ui).
16 lines (15 loc) • 575 B
TypeScript
/// <reference types="react" />
/**
* If for some reason you can't cleanup or clear the timeouts properly,
* you can use the following hook to verify just before setting state
* if the component is still mounted.
* Usage:
* import {useIsComponentMountedRef} from '@selfcommunity/react-core';
*
* const MyComponent = () => {
* const isMountedRef = useIsComponentMountedRef();
* // ex: isMountedRef.current && setState(...)
* };
*/
declare const useIsComponentMountedRef: () => import("react").MutableRefObject<boolean>;
export default useIsComponentMountedRef;