WARNING in ./node_modules/@redux-saga/core/dist/redux-saga-core.esm.js 1343:21-28
"export 'compose' was not found in 'redux'
@ ./node_modules/redux-saga/dist/redux-saga-core-npm-proxy.esm.js
@ ./src/store.js
@ ./src/App.js
@ ./src/index.js
WARNING in ./src/store.js 6:21-32
"export 'createStore' was not found in 'redux'
@ ./src/App.js
@ ./src/index.js
我正面临创建redux商店的问题。在这里,我添加了示例代码。如果我从App.js中删除提供程序,它就可以正常工作。有人能帮我解决这个问题吗?
App.js
import React from 'react';
import Layout from './components/Layout';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import { store } from './store'
const App = () => {
return (
<Provider store={store}>
<BrowserRouter>
<Layout/>
</BrowserRouter>
</Provider>
);
}
export default App;
store.js
import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from 'redux-saga'
import reducers from './redux';
import sagas from './sagas';
const sagaMiddleware = createSagaMiddleware()
export const store = createStore(
reducers,
applyMiddleware(sagaMiddleware)
)
sagaMiddleware.run(sagas)
减速器
import { combineReducers } from 'redux';
import { reducer as auth } from './AuthRedux'
const reducers = combineReducers({
auth
});
export default reducers;
sagas
import { takeLatest, all } from 'redux-saga/effects';
import api from '../middleware/api';
import { AuthTypes } from '../redux/AuthRedux'
import { signupSaga } from './AuthSaga'
export default function * root () {
const sagaIndex = [
yield takeLatest(AuthTypes.SIGNUP, signupSaga, api),
];
yield all(sagaIndex)
}
我想这与redux和我如何导入东西有关,但我不确定那里出了什么问题。
感谢
在store.js中替换
export const store = createStore(
reducers,
applyMiddleware(sagaMiddleware)
)
带有
export const store = createStore(
reducers,
{},
applyMiddleware(sagaMiddleware)
)
只是黑暗中的一支箭,因为它对我有效,也许它应该对你有效