Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Haste模块映射中不存在模块'EmployeeFormReducer'_Reactjs_React Native - Fatal编程技术网

Reactjs Haste模块映射中不存在模块'EmployeeFormReducer'

Reactjs Haste模块映射中不存在模块'EmployeeFormReducer',reactjs,react-native,Reactjs,React Native,我正在处理React本机应用程序,并在出现以下错误时重新加载模拟器: Haste模块映射中不存在模块EmployeeFormReducer EmployeeFormReducer是我已经拥有的一个reducer,我在模拟器中测试它之前添加了EMPLOYEE\u UPDATE案例: import { EMPLOYEE_UPDATE } from '../actions/types'; const INITIAL_STATE = { name: '', phone: '', shift

我正在处理React本机应用程序,并在出现以下错误时重新加载模拟器:

Haste模块映射中不存在模块
EmployeeFormReducer

EmployeeFormReducer
是我已经拥有的一个reducer,我在模拟器中测试它之前添加了
EMPLOYEE\u UPDATE
案例:

import { EMPLOYEE_UPDATE } from '../actions/types';

const INITIAL_STATE = {
  name: '',
  phone: '',
  shift: ''
};

export default (state = INITIAL_STATE, action) => {
  switch (action.type) {
    case EMPLOYEE_UPDATE:
      return { ...state, [action.payload.prop]: action.payload.value };
    default:
      return state;
  }
};
我没有忘记将其添加到我的Combinereducer中:

import { combineReducers } from 'redux';
import AuthReducer from './AuthReducer';
import EmployeeFormReducer from 'EmployeeFormReducer';

export default combineReducers({
  auth: AuthReducer,
  employeeForm: EmployeeFormReducer
});
我认为这是基于facebooks github上记录的React Native问题:

这可能与 解决 以下是: 1.清除看守人手表:
watchman watch del all
。 2.删除
node\u模块
文件夹:
rm-rf node\u模块和&npm安装
。 3.重置高速捆绑机缓存:
rm-rf/tmp/Metro捆绑机缓存-*
npm启动---重置缓存
。4.移除加速缓存:`rm-rf /tmp/haste map react本机包装机-*


但是,我运行了所有这些命令,但仍然出现了错误。

在导入过程中,您应该指定要导入的文件的路径,看看如何导入“AuthReducer”,因此“EmployeeFormReducer”的导入应该是:

 import EmployeeFormReducer from './EmployeeFormReducer';

或者任何文件的完整路径。

这就是我答应自己不加班的原因。非常感谢。