繁体   English   中英

将React Native与Redux结合使用

[英]Using React Native with Redux

所以我正在尝试使用redux与react,我一直在模拟器中收到此错误

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. 

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. 

ExceptionsManager.js:63Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. 

我将问题归结为

      <Provider store={store}>
        <App />
      </Provider>

当我删除提供程序时,App渲染的内容(假设它们是一个简单的“ Hello World”文本组件)。 当我放回去时,它没有。

我知道在较早版本的react中这是一个问题,但是我在15.4.0

但以防万一,我尝试做这样的事情

// wrapper.js
const wrapper = () => {
  return (
    <Provider store={store}>
      {() => <App />}
    </Provider>
  );
}

// index

AppRegistry.registerComponent('BasketballAndroidFrontend', () => wrapper);

我该如何解决? 我什至正确诊断了吗?

当您看到消息“期望字符串(对于内置组件)或类/函数”。 实际上,因为您没有导出作用中的函数或化简器。 请仔细检查。

欢呼!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM