mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
345 B
345 B
useForceUpdate
React hook that returns a function to trigger a manual re-render of a component
Usage
import { useForceUpdate } from 'react-use'
const Demo = () => {
const forceUpdate = useForceUpdate()
return (
<div>
{Math.random()}
<button onClick={forceUpdate}>Force update</button>
</div>
)
}