From 682646ae01d01936fa83d47b69d322a98c69f7d7 Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Tue, 9 May 2023 01:28:58 -0300 Subject: [PATCH] chore: improve setTarget tn --- src/hooks/useFundingFormState.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hooks/useFundingFormState.tsx b/src/hooks/useFundingFormState.tsx index b94b562df..69732d6ff 100644 --- a/src/hooks/useFundingFormState.tsx +++ b/src/hooks/useFundingFormState.tsx @@ -63,14 +63,10 @@ export const useFundingFormState = ({ rewards }: UseFundStateProps) => { const [state, _setState] = useState(initialState) - const setTarget = useCallback( - (event: any) => { - const { name, value } = event.target - const newState = { ...state, [name]: value } - _setState(newState) - }, - [state], - ) + const setTarget = useCallback((event: any) => { + const { name, value } = event.target + _setState((current) => ({ ...current, [name]: value })) + }, []) const setState = useCallback((name: string, value: any) => { _setState((current) => ({ ...current, [name]: value }))