UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

20 lines (17 loc) 514 B
import * as React from 'react'; /** * Hook version of `component.forceUpdate()` or `this.forceUpdate()`. * * Example usage: * ```js * const forceUpdate = useForceUpdate(); * ``` * * You can tell React that the component needs re-rendering by calling `forceUpdate()` * * See https://reactjs.org/docs/react-component.html#forceupdate for more details. * */ export function useForceUpdate(): () => void { const [, setCounter] = React.useState(0); return () => setCounter((counter) => counter + 1); }