导入reducer时出现此错误。
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import {Provider} from 'react-redux';
import {createStore} from 'redux';
import {rootReducer } from './Reducers';
const store = createStore(rootReducer);
ReactDOM.render((
<Provider store={store}><App /></Provider>
), document.getElementById('root'));
Reducers / Reducer_placeorder .js
export default function(state = [], action) {
switch (action.type) {
case "PLACE_ORDER":
return action.payload;
}
return state;
}
减速/ index.js
import { combineReducers } from "redux";
import Reducer_placeorder from "./Reducer_placeorder";
const rootReducer = combineReducers({
data: Reducer_placeorder
})
export default rootReducer;
在运行时我得到的错误不包含名为的导出 'rootReducer'
我尝试从'./Reducers'导入为“import {reducer}”;“ , 我仍然得到错误不包含名为'reducer'的导出