diff --git a/src/useUpdate.ts b/src/useUpdate.ts index 495dc04e88..e85142d093 100644 --- a/src/useUpdate.ts +++ b/src/useUpdate.ts @@ -1,10 +1,11 @@ -import { useState, useCallback } from 'react'; +import { useCallback, useState } from 'react'; + +const incrementParameter = (num: number): number => ++num; const useUpdate = () => { const [, setState] = useState(0); // useCallback with empty deps as we only want to define updateCb once - const updateCb = useCallback(() => setState(cnt => cnt + 1), []); - return updateCb; + return useCallback(() => setState(incrementParameter), []); }; export default useUpdate;