From 4effd946a408fd91eff6af8afcbbb435570bbe35 Mon Sep 17 00:00:00 2001 From: Cledwyn Lew Date: Wed, 3 Sep 2025 17:34:12 +0800 Subject: [PATCH] feat: MujianProvider --- src/main.tsx | 7 ++- src/pages/home/index.tsx | 10 ++-- src/providers/MujianProvider.tsx | 51 +++++++++++++++++++ ...{RouterPorvider.tsx => RouterProvider.tsx} | 0 src/utils/mujian.ts | 13 ----- 5 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 src/providers/MujianProvider.tsx rename src/providers/{RouterPorvider.tsx => RouterProvider.tsx} (100%) delete mode 100644 src/utils/mujian.ts diff --git a/src/main.tsx b/src/main.tsx index 88d8d3c..989bfd2 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -2,10 +2,13 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import '@/styles/fonts.css'; import '@/styles/global.css'; -import { ReactRouterProvider } from './providers/RouterPorvider.tsx'; +import { MujianProvider } from './providers/MujianProvider.tsx'; +import { ReactRouterProvider } from './providers/RouterProvider.tsx'; createRoot(document.getElementById('root')!).render( - + + + , ); diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index a122749..f9e190c 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -1,16 +1,16 @@ import { useGlobalStore } from '@/store/global'; import './index.css'; import { isEmpty } from 'lodash-es'; -import { EVENT, getMujian } from '@/utils/mujian'; +import { EVENT, useMujian } from '@/providers/MujianProvider'; function Home() { const { count, increment } = useGlobalStore((state) => state); + const mujian = useMujian(); console.log('count', count); console.log('isEmpty', isEmpty(count)); - return ( <>
@@ -20,15 +20,15 @@ function Home() { - +

Count: {count}