使用Zustand与NextJS时遭遇“Cannot access 'createResettable' before initialization”初始化前访问错误的求助
使用Zustand与NextJS时遭遇“Cannot access 'createResettable' before initialization”初始化前访问错误的求助
我在Zustand和NextJS里写了几个简单的组件,不知道为啥突然碰到这个错误:Cannot access 'createResettable' before initialization。我明明已经定义了createResettable函数,而且导入路径也反复确认过是对的啊,实在搞不懂问题出在哪……
下面是我的./quoteStore.ts代码片段:
import { createResettable } from "../_hooks/hooks"; // 已经确认导入路径正确 import { type Customer } from "./types"; type QuoteStore = { id: string | null; date: string | null; customer: Customer | null; subTotal: string; tax: string; total: string; taxRate: number; //Setters setCustomer: (customer: Customer | null) => void; setQuoteDefaults: ( input: Pick< QuoteStore, "id" | "date" | "customer" | "subTotal" | "tax" | "total" | "taxRate" >, ) => void; setTotals: (subTotal: string, tax: string, total: string) => ...; };
备注:内容来源于stack exchange,提问作者mogcast
相关产品推荐
相关产品推荐

