aboutsummaryrefslogtreecommitdiff
path: root/src/components/hooks/useModified.ts
blob: ea88888a5d53d354003a6713b4c5ee027a77d4a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { create } from 'zustand';

const store = create(() => ({}));

export function touch(key: string) {
  store.setState({ [key]: Date.now() });
}

export function useModified(key?: string) {
  const modified = store(state => state?.[key]);

  return { modified, touch };
}