- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
运行我的应用程序时出现此错误:
WARNING Compiled with 1 warnings 11:50:40 PMwarning in ./src/store/store.js"export 'createStore' was not found in 'vuex'
npm install --save vuex
安装了 vuex
import { createStore } from "vuex";
import Movie from './Modules/Movie'
import post from './Modules/post'
const store = createStore({
modules: {
post,
Movie
},
});
export default store;
我的 main.js:
import { createApp } from 'vue';
import App from './App.vue';
import router from './router'
import store from './store/store.js'
const app = createApp(App);
app.use(store);
app.use(router);
app.mount('#app');
最佳答案
您已经通过运行 npm install --save vuex
安装了 Vuex 3.x 版。你应该卸载它 npm uninstall --save vuex
然后通过运行以下命令安装与 vue 3 兼容的版本 4:
npm install --save vuex@next
对于使用 Yarn 的人,下面是命令
yarn add vuex@next
关于Vue.js 3 - "export ' createStore' 未在 'vuex' 中找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65150323/
我正在尝试学习 Redux,因此我创建了一个测试应用程序,但似乎我无法应用中间件并创建我的商店,因为我收到错误'createStoreWithMiddleware' is not Define . 我
在 redux store 中,是否可以将不同的 reducer 集加载到一个 store 中?我的尝试失败了 import userReducers from './reducers' import
这个 createStore 函数采用了 reducer 函数,但我真的不明白发生了什么,当我们执行 store.getState() 时,它如何知道计数器的当前状态,我知道 createStore(
我目前正在研究 Redux.js。由于喜欢阅读源代码,我立即开始研究 Redux 源代码。 阅读the createStore code ,我陷入了以下代码: export default funct
我正在使用 react 和 redux 创建一个简单的计数器应用程序。 以下是counterSlice.js文件。 import { createSlice } from "@reduxjs/tool
全部: 当我阅读 Redux 的源代码时,在它的 createStore 中: function createStore(reducer, initialState, enhancer) {
我在学习 Redux 时遇到了 createStore 函数。因此,据我了解,createStore 接收 3 个参数: reducer initial state enhancers (for si
在撰写有关将 Redux 状态与组件解耦的博客文章时,我注意到 createStore 中使用的 enhancer 的用法 link : export default function createS
我正在尝试编写 redux 集成测试。我的测试成功通过,但是,我收到消息: console.error node_modules/redux/lib/utils/warning.js:14 Unexp
使用createStore时,需要1个参数和2个可选参数: reducer(函数):在给定当前状态树和要处理的操作的情况下,返回下一个状态树的缩减函数。 preloadedState(任何):初始状态
当我尝试npm start 我的项目时,我在终端上没有看到任何错误。我是 react-redux-firebase 的新手。这是我使用浏览器看到的错误: TypeError: Object(...)
我尝试通过 Reflux 存储中的 this 设置状态属性,但每当我尝试设置属性时,都会收到以下错误: 未捕获类型错误:无法读取未定义的属性“触发器” 我使用 Babel 来编译我的 JSX,所以不确
我想将多个增强器函数传递给 Redux 的 createStore 函数。 这种方法没有有效: const store = createStore(rootReducer, [composeWithD
createStore 已被@deprecated,所以我试图用 configurationStore 替换,我认为来 self 的集群的发布数据因此没有显示 ``` import React fro
这可能吗? 我正在使用 redux存储在 IoC 环境中,并希望在创建后将中间件添加到存储中。 例如。: class MyApp { store = createStore(...); } let
我有一个运行 redux 和 thunk 的 React 应用程序,它一直运行良好。我需要在页面重新加载时保持存储状态,以便数据不会丢失,因此创建了一个将数据存储在 localstorage 中的函数
你能帮我解决异常吗 在传递给 createStore 的 preloadedState 参数中发现意外的键“userName”。期望找到一个已知的缩减器键:“默认”。意外键将被忽略。 我发现了这个 L
我找到了两种配置 redux createStore 的方式, 1. https://github.com/TeamWithBR/SampleProjectTodo/blob/master/src/s
所以,createStore() Redux 现已弃用,configureStore()推荐来自 @reduxjs/toolkit . 我很确定这与无法获得 userInfo 有关状态使用 getSt
当我的 react-native 应用程序启动时,我无法初始化我的 redux-state。我需要在应用程序启动之前进行 api 调用以检索数据以保持状态。我想将此调用的结果传递给我的 Provide
我是一名优秀的程序员,十分优秀!