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