Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
346 Bytes
import { useState } from 'react'
import { useIsMounted } from './useIsMounted'
/** Return a function that re-renders this component, if still mounted */
export function useForceUpdate() {
const update = useState<any>()[1]
const isMounted = useIsMounted()
return () => {
if (isMounted.current) {
update(Math.random())
}
}
}