我有一个带有 next-redux-wrapper 和我的商店代码的应用程序
import { createStore, applyMiddleware } from "redux";
import reducer from "./reducers";
import reduxThunk from "redux-thunk";
export default (initialState = undefined, { storeKey = "app" }) => {
return createStore(reducer, initialState, applyMiddleware(reduxThunk));
};
我正在使用 Redux next-redux-wrapper 导入商店和导出应用程序
一切正常,但我想从非组件文件访问商店
import store from "../redux/store";
export const lang = store(undefined, { storeKey: "app" }).getState().user
.language;
当我在主商店更改它时,lang 没有改变