react中引入createStore无效

问题描述

在store.js里import { createStore } from 'redux'之后,会有一条删除线

原因

新版本中,redux的createStore方法已废弃

改为使用@reduxjs/toolkit包下的configureStore 方法

解决方法

import { configureStore } from '@reduxjs/toolkit'
import countReducer from './count_reducer'
export default configureStore({reducer:countReducer})

猜你喜欢

转载自blog.csdn.net/weixin_49662044/article/details/131771898
今日推荐