首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在创建Redux存储后生成错误(React本机+ Redux)

在创建Redux存储后生成错误(React本机+ Redux)
EN

Stack Overflow用户
提问于 2021-03-20 17:09:40
回答 1查看 228关注 0票数 0

我开始从我的站点(ReactJS + Redux + Express)开发这个应用程序,我想为应用程序和站点使用相同的后端和数据库。现在决定重用我的大部分ReactJS代码,因为我知道我可以使用相同的函数。我在我的主文件夹中创建了Redux存储,但是在构建时它不能工作,它给了我以下错误:

代码语言:javascript
运行
复制
 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连接到应用程序。这是我的店:

代码语言:javascript
运行
复制
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:

代码语言:javascript
运行
复制
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 = ...应用程序工作时。真的不明白为什么

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-03 10:37:54

试试这个=>

代码语言:javascript
运行
复制
import thunk from 'redux-thunk';
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66724329

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档