useUpdate
A hook to force a component to re-render
Loading...
Installation
npx shadcn@latest add @hooks/use-updatepnpm dlx shadcn@latest add @hooks/use-updateyarn dlx shadcn@latest add @hooks/use-updatebun x shadcn@latest add @hooks/use-updateCopy and paste the following code into your project.
import { useCallback, useState } from 'react'
export function useUpdate() {
const [, setState] = useState({})
return useCallback(() => setState({}), [])
}API
/**
* A hook to force a component to re-render
* @returns A function to force a component to re-render
*/
export function useUpdate(): () => voidCredits
Last updated on