This commit is contained in:
2025-03-20 14:53:02 +00:00
parent 111b6fbadd
commit 9cd93e60df
10 changed files with 227 additions and 95 deletions

View File

@@ -1,3 +1,4 @@
"use client";
// stores/storeContext.ts
import { createContext, useContext } from "react";
import { CounterStore } from "./counterStore";
@@ -12,7 +13,7 @@ export const initializeStores = (initialData = {}) => {
const counterStore = new CounterStore();
// 服务端预取数据注入
if (initialData.counterStore) {
if (initialData?.counterStore) {
counterStore.count = initialData.counterStore.count;
}