UNPKG

@trellixio/roaster-coffee

Version:
28 lines 771 B
/** * A custom React hook that returns a function to forcefully update a component. * This hook utilizes the `useReducer` hook to update a value that is not used, which forces a re-render of the component. * * @returns A function that can be called to force a re-render of the component. * * @example *```tsx * function MyComponent() { * const forceUpdate = useForceUpdate(); * const [count, setCount] = useState(0); * * const handleClick = () => { * setCount(count + 1); * forceUpdate(); * }; * * return ( * <div> * <p>Count: {count}</p> * <button onClick={handleClick}>Increment</button> * </div> * ); * } * ``` */ export declare function useForceUpdate(): () => void; //# sourceMappingURL=index.d.ts.map