Ниже приведены мои файлы для моего реактивного приложения:
UserReducer.js
import { ActionTypes } from '../actions/ActionConstants';
export default function UserReducer(state = {}, action) {
switch (action.type) {
case ActionTypes.LOGIN_REQUEST:
return {
...state
};
case ActionTypes.LOGIN_SUCCESS:
return {
...state
};
case ActionTypes.LOGIN_FAILURE:
return {};
case ActionTypes.LOGOUT:
return {};
default:
return state
}
}
RootReducer.js
import { combineReducers } from 'redux';
import UserReducer from './UserReducer';
const rootReducer = combineReducers({
user: UserReducer,
});
export default rootReducer;
index.js в папке редукторов
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import rootReducer from './RootReducer';
const loggerMiddleware = createLogger();
export const store = createStore(
rootReducer,
applyMiddleware(
thunkMiddleware,
loggerMiddleware
)
);
Запуск моего приложения по реакции-native run-android.Экспорт по умолчанию для UserReducer дает мне эту ошибку: (0, _reducers2.default) не является функцией