From 27a22bd779616a42dafa1a8265395b9124df4096 Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Sun, 25 Jun 2023 14:35:37 +0800 Subject: [PATCH] change global store name --- app/home-modle.tsx | 6 +++--- store/index.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/home-modle.tsx b/app/home-modle.tsx index 1a2109c..79b101c 100644 --- a/app/home-modle.tsx +++ b/app/home-modle.tsx @@ -2,7 +2,7 @@ import { Canvas, useFrame, useLoader, useThree } from '@react-three/fiber'; import { useEffect, useRef } from 'react'; -import useMainStore from 'store'; +import useStore from 'store'; import * as THREE from 'three'; import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; @@ -15,7 +15,7 @@ const rotationX = 0.18; const Model = () => { const mixer = useRef(null); - const toggleLoading = useMainStore((state) => state.toggleLoading); + const toggleLoading = useStore((state) => state.toggleLoading); const camera = useThree((state) => state.camera); const gltf = useLoader( @@ -79,7 +79,7 @@ const Model = () => { }; const HomeModel = () => { - const modelLoading = useMainStore((state) => state.modelLoading); + const modelLoading = useStore((state) => state.modelLoading); return ( <> diff --git a/store/index.ts b/store/index.ts index 3946499..1fd024f 100644 --- a/store/index.ts +++ b/store/index.ts @@ -5,7 +5,7 @@ interface MainStore { toggleLoading: (loaded: boolean) => void; } -const useMainStore = create()((set) => ({ +const useStore = create()((set) => ({ modelLoading: true, toggleLoading: (loaded) => set(() => ({ @@ -13,4 +13,4 @@ const useMainStore = create()((set) => ({ })), })); -export default useMainStore; +export default useStore;