我开始从我的站点(ReactJS + Redux + Express)开发这个应用程序,我想为应用程序和站点使用相同的后端和数据库。现在决定重用我的大部分ReactJS代码,因为我知道我可以使用相同的函数。我在我的主文件夹中创建了Redux存储,但是在构建时它不能工作,它给了我以下错误:
ERROR TypeError: undefined is not a function, js engine: hermes
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
我试过每一个商店的布局,但似乎行不通。我甚至无法将RNDebugger连接到应用程序。这是我的店:
import {createStore, applyMiddleware, compose} from 'redux';
import {thunk} from 'redux-thunk';
import rootReducer from './src/reducers';
const initialState = {};
const middleware = [thunk];
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
rootReducer,
initialState,
composeEnhancers(
applyMiddleware(...middleware),
),
);
export default store;
我的App.js:
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import DrawerNavigator from './src/routes/DreawerNavigator';
import {Provider} from 'react-redux';
import store from './store';
export default function App() {
return (
<Provider store={store}>
<NavigationContainer>
<DrawerNavigator />
</NavigationContainer>
</Provider>
);
}
任何人都可以向我解释为什么它不能工作,以及我如何能够连接到我的应用程序RNDebugger?
编辑:我发现错误位于store.js文件中,当我评论const store = ...
应用程序工作时。真的不明白为什么
发布于 2021-05-03 10:37:54
试试这个=>
import thunk from 'redux-thunk';
https://stackoverflow.com/questions/66724329
复制相似问题