moodist/src/components/store-consumer/store-consumer.tsx
2024-08-31 00:10:58 +03:30

19 lines
486 B
TypeScript

import { useEffect } from 'react';
import { useSoundStore } from '@/stores/sound';
import { useNoteStore } from '@/stores/note';
import { usePresetStore } from '@/stores/preset';
interface StoreConsumerProps {
children: React.ReactNode;
}
export function StoreConsumer({ children }: StoreConsumerProps) {
useEffect(() => {
useSoundStore.persist.rehydrate();
useNoteStore.persist.rehydrate();
usePresetStore.persist.rehydrate();
}, []);
return <>{children}</>;
}