Javascript 找不到“;商店「;在「;连接(AppComponent)";

Javascript 找不到“;商店「;在「;连接(AppComponent)";,javascript,reactjs,react-native,react-redux,Javascript,Reactjs,React Native,React Redux,我发现了这个错误,我在谷歌上搜索了解决方案,但似乎一切都应该正确设置 完全错误为: 不变冲突:在“Connect(AppComponent)”的上下文中找不到“store”。请在中包装根组件,或在连接选项中将自定义React上下文提供程序传递给和相应的React上下文使用者以连接(AppComponent) 此错误位于RCTView(在View.js:45)中的Connect(AppComponent)(在renderApplication.js:34)中的视图(在AppContainer.js

我发现了这个错误,我在谷歌上搜索了解决方案,但似乎一切都应该正确设置

完全错误为: 不变冲突:在“Connect(AppComponent)”的上下文中找不到“store”。请在中包装根组件,或在连接选项中将自定义React上下文提供程序传递给和相应的React上下文使用者以连接(AppComponent)

此错误位于RCTView(在View.js:45)中的Connect(AppComponent)(在renderApplication.js:34)中的视图(在AppContainer.js:98)中的RCTView(在View.js:45)中的视图(在AppContainer.js:115)中的AppContainer(在renderApplication.js:33)中

这是我的代码:

index.js

import { Provider } from 'react-redux'
import { createStore } from 'redux';

import App from './app/App';
import appState from './app/redux/reducers';

import {name as appName} from './app.json';

let store = createStore(appState);
export default class AppRoot extends Component {
  render() {
    return (
      <Provider store={store}>
        <App/>
      </Provider>
    );
  }
}

AppRegistry.registerComponent(appName, () => App);
index.js(in/reducers)


在根目录下注册的
App
组件不是
approt
。这意味着React render
App
没有
提供程序提供存储。然后
connect
HOC抛出错误。您必须更新对以下内容的调用:

AppRegistry.registerComponent(appName, () => AppRoot);
import { combineReducers } from 'redux';

//imports...

let appState = combineReducers({
    //all import...
});

export default appState;
AppRegistry.registerComponent(appName, () => AppRoot);