0.1.32 • Published 3 years ago

@technote-space/use-unmount-ref v0.1.32

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

useUnmountRef

npm version CI Status codecov CodeFactor License: MIT

React hook to handle unmount ref.

Table of Contents

Usage

Install

yarn add @technote-space/use-unmount-ref

or

npm i @technote-space/use-unmount-ref

Use

e.g.

import type { FC } from 'react';
import { useEffect, useState } from 'react';
import useUnmountRef from '@technote-space/use-unmount-ref';

const TestPage: FC = () => {
  const unmountRef = useUnmountRef();
  const [isLoading, setIsLoading] = useState(false);
  
  useEffect(() => {
    setIsLoading(true);
    setTimeout(() => {
      if(!unmountRef.current) {
        setIsLoading(false);
      }
    }, 1000);
  }, []);
  
  return <div>
    {isLoading ? 'Loading...' : 'Not loading.'}
  </div>
};

Author

GitHub (Technote)
Blog

0.1.32

3 years ago

0.1.31

3 years ago

0.1.30

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.27

3 years ago

0.1.25

4 years ago

0.1.26

3 years ago

0.1.23

4 years ago

0.1.24

4 years ago

0.1.22

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.9

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago