From 53b63ac27c2275262db9a04be02210a3287aa71d Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 1 Dec 2023 19:34:58 +0100 Subject: 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 --- src/utils/hooks/use-is-mounted.tsx | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/utils/hooks/use-is-mounted.tsx (limited to 'src/utils/hooks/use-is-mounted.tsx') 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} ref - A React reference to an HTML element. - * @returns {boolean} True if the HTML element is mounted. - */ -export const useIsMounted = (ref: RefObject): boolean => { - const [isMounted, setIsMounted] = useState(false); - - useEffect(() => { - if (ref.current) setIsMounted(true); - }, [ref]); - - return isMounted; -}; -- cgit v1.2.3