Skip to content

Commit

Permalink
Merge pull request #1022 from otakustay/master
Browse files Browse the repository at this point in the history
修复useUnmountedRef与并发模式的不兼容性
  • Loading branch information
brickspert authored Jul 11, 2021
2 parents 7b026c0 + d07d62d commit 16ef302
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/hooks/src/useUnmountedRef/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useRef, useEffect } from 'react';
const useUnmountedRef = () => {
const unmountedRef = useRef(false);
useEffect(() => {
unmountedRef.current = false;

return () => {
unmountedRef.current = true;
};
Expand Down

0 comments on commit 16ef302

Please sign in to comment.