aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/hooks/use-is-mounted.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-12-01 19:34:58 +0100
committerArmand Philippot <git@armandphilippot.com>2023-12-04 19:00:04 +0100
commit53b63ac27c2275262db9a04be02210a3287aa71d (patch)
tree814968e10cad25e1b34ab251de42ac5ecb82b346 /src/utils/hooks/use-is-mounted.tsx
parent11e3ee75fcab0ab54b2bc1713a402c5cc3070c2d (diff)
refactor(pages): refine Blog pages
* replace usePostsList with useArticlesList to keep names coherent * remove useIsMounted hook * rewrite useRedirection hook * add redirect in getStaticProps to avoid unecessary fetching * move Pagination component in a noscript tag * use hooks to refresh thematics and topics lists * complete Cypress tests
Diffstat (limited to 'src/utils/hooks/use-is-mounted.tsx')
-rw-r--r--src/utils/hooks/use-is-mounted.tsx17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/utils/hooks/use-is-mounted.tsx b/src/utils/hooks/use-is-mounted.tsx
deleted file mode 100644
index 4d85d45..0000000
--- a/src/utils/hooks/use-is-mounted.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { RefObject, useEffect, useState } from 'react';
-
-/**
- * Check if an HTML element is mounted.
- *
- * @param {RefObject<HTMLElement>} ref - A React reference to an HTML element.
- * @returns {boolean} True if the HTML element is mounted.
- */
-export const useIsMounted = (ref: RefObject<HTMLElement>): boolean => {
- const [isMounted, setIsMounted] = useState<boolean>(false);
-
- useEffect(() => {
- if (ref.current) setIsMounted(true);
- }, [ref]);
-
- return isMounted;
-};