useForceUpdate
반환된 함수를 실행하면 강제로 컴포넌트가 리렌더링
시키는 커스텀 훅입니다.
Interface
// type DispatchWithoutAction = () => void;
const useForceUpdate: () => React.DispatchWithoutAction
Usage
import { useForceUpdate } from '@devgrace/react';
const Example = () => {
const forceUpdate = useForceUpdate();
const handleForceUpdate = useCallback(() => {
forceUpdate();
}, [forceUpdate]);
return (
<div>
<button onClick={handleForceUpdate}>Button</button>;
</div>
);
};