1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/hooks/useGlobalLocalStorage.ts
Nuno Góis 4afd505164
feat: make favorites a global preference (#2685)
https://linear.app/unleash/issue/2-508/make-pinned-favorites-a-global-preference

Also introduces a `useGlobalLocalStorage` hook where system-wide
preferences that are stored in LocalStorage can be maintained.
2022-12-13 13:20:43 +00:00

18 lines
324 B
TypeScript

import { createLocalStorage } from 'utils/createLocalStorage';
interface IGlobalStore {
favorites?: boolean;
}
export const useGlobalLocalStorage = () => {
const { value, setValue } = createLocalStorage<IGlobalStore>(
'global:v1',
{}
);
return {
value,
setValue,
};
};