Redux 和 React-Native:无法读取未定义的 属性 'type'

Redux and React-Naitve: Cannot read property 'type' of undefined

我正在尝试在我的第一个 react-native 应用程序中设置 ducks 和 sagas。但是每当我尝试调用 duck 函数时,我都会看到一个红屏:Cannot read 属性 'type' of undefined

正在创建 Redux store,但不知道为什么它没有在 switch case 中采取行动。

以下代码来自我的 ducks/auth.js

import { fromJS, List } from 'immutable';

const action = name => `/auth/${name}`;

export const LOGIN_REQUEST = action('LOGIN_REQUEST');

export const loginRequest = () => ({ type: LOGIN_REQUEST, });

export const FETCH_LOGIN_REQUEST = action('FETCH_LOGIN_REQUEST');
export const fetchLoginRequest = login => ({ type: FETCH_LOGIN_REQUEST, login });

const initialState = {
  token: null,
}

const auth = (state = initialState, action) => {
  console.log('Hello Action: ', action.type);

  switch (action.type) {

    case FETCH_LOGIN_REQUEST:
      return state.set('token', action.login);

    default:
      console.log('Hello Auth Ducks Default')
      return state;
  }
};

export default auth;

在welcome.js中更改

import loginRequest from '../ducks/auth.js';

import {loginRequest} from '../ducks/auth.js';

loginRequest 是命名导出,而不是默认导出。