From 9c2c904d18dfff311851ba97901166a437e8a16b Mon Sep 17 00:00:00 2001 From: stephenjtyrrell Date: Thu, 13 Mar 2025 15:57:33 +0000 Subject: [PATCH] Amending dependencylist to ensure it's always an array, to resolve eslint error. --- src/useUpdateEffect.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/useUpdateEffect.ts b/src/useUpdateEffect.ts index 736abf8c0c..6eceae4cba 100644 --- a/src/useUpdateEffect.ts +++ b/src/useUpdateEffect.ts @@ -1,13 +1,14 @@ -import { useEffect } from 'react'; +import { useEffect, DependencyList, EffectCallback } from 'react'; import { useFirstMountState } from './useFirstMountState'; -const useUpdateEffect: typeof useEffect = (effect, deps) => { +const useUpdateEffect = (effect: EffectCallback, deps: DependencyList): void => { const isFirstMount = useFirstMountState(); useEffect(() => { if (!isFirstMount) { return effect(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, deps); };