add global state

This commit is contained in:
DefectingCat
2023-05-16 15:04:51 +08:00
parent bf3a916ae5
commit 39684f7dde
5 changed files with 66 additions and 15 deletions

16
store/index.ts Normal file
View File

@ -0,0 +1,16 @@
import { create } from 'zustand';
interface MainStore {
modelLoading: boolean;
toggleLoading: (loaded: boolean) => void;
}
const useMainStore = create<MainStore>()((set) => ({
modelLoading: true,
toggleLoading: (loaded) =>
set(() => ({
modelLoading: loaded,
})),
}));
export default useMainStore;