Skip to content

Commit

Permalink
fix: be compatible with react 18 StrictMode in dev (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrickyPi authored May 26, 2022
1 parent bab49df commit c3f64d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hooks/useRaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default function useRaf<Callback extends Function>(callback: Callback) {
}

useEffect(() => {
//be compatible with react 18 StrictMode in dev
removedRef.current = false;

return () => {
removedRef.current = true;
raf.cancel(rafRef.current);
Expand Down

1 comment on commit c3f64d6

@vercel
Copy link

@vercel vercel bot commented on c3f64d6 May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tabs – ./

tabs-react-component.vercel.app
tabs-git-master-react-component.vercel.app

Please sign in to comment.