Convert useModified into a real hook.

This commit is contained in:
Mike Cao 2024-02-07 23:48:51 -08:00
parent a426c242cb
commit 91e3dff7f5
24 changed files with 63 additions and 48 deletions

View file

@ -0,0 +1,15 @@
import useStore from 'store/modified';
export function useModified(key?: string) {
const modified = useStore(state => state?.[key]);
const touch = (id?: string) => {
if (id || key) {
useStore.setState({ [id || key]: Date.now() });
}
};
return { modified, touch };
}
export default useModified;