Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
297 Bytes
import { useState } from 'react';
import { dequal } from '../lib/dequal';
export function useStableValue<TValue>(value: TValue) {
const [stableValue, setStableValue] = useState<TValue>(() => value);
if (!dequal(stableValue, value)) {
setStableValue(value);
}
return stableValue;
}