./Reducers'不包含名为'rootReducer'的导出

时间:2018-03-20 07:56:08

标签: reactjs redux react-redux

  

导入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'的导出

0 个答案:

没有答案