mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-26 05:23:59 +01:00
13 lines
315 B
TypeScript
13 lines
315 B
TypeScript
|
import React, { useEffect } from 'react';
|
||
|
import useStore from '@store/store';
|
||
|
|
||
|
const useSaveToLocalStorage = () => {
|
||
|
const chats = useStore((state) => state.chats);
|
||
|
|
||
|
useEffect(() => {
|
||
|
if (chats) localStorage.setItem('chats', JSON.stringify(chats));
|
||
|
}, [chats]);
|
||
|
};
|
||
|
|
||
|
export default useSaveToLocalStorage;
|