Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Yen Truong committed Dec 9, 2021
1 parent ddc4562 commit 7aa4889
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sample-app/src/hooks/useComponentMountStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { useEffect, useRef } from "react";

/**
* This is use to prevent react errors due to performing state update on unmounted component.
* This error does not need to be suppressed as it will be remove in the next version of React.
*
* React PR regarding the issue: https://github.com/facebook/react/pull/22114
*/
export default function useComponentMountStatus() {
const isMountedRef = useRef<boolean>(false);
useEffect(() => {
Expand Down

0 comments on commit 7aa4889

Please sign in to comment.