react-native - 不变违规 : Element type is invalid - React Native

标签 react-native react-redux

我的 React Native 应用程序的 App.js 中有以下代码。

import React from 'react';
import Provider from 'react-redux';
import {Text} from 'react-native';

const App: () => React$Node = () => {
  return (
    <Provider>
    <Text>hello</Text>
    </Provider>
  );
};
export default App;

它不起作用并抛出如下错误,

enter image description here

最佳答案

改变

import Provider from 'react-redux';

import {Provider} from 'react-redux';

在此之后,不要忘记将商店作为属性传递给提供者

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

关于react-native - 不变违规 : Element type is invalid - React Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59591305/

相关文章:

amazon-s3 - 将 base64 字符串保存到 Amazon S3

javascript - React Native ListView 数据源始终为 null

firebase - 我没有看到任何 admob 制作广告。在 native react

reactjs - i18next-xhr-backend 获取数据失败 React-Native

reactjs - redux 中的去抖 API 调用

javascript - React-Router Link 不触发组件刷新

javascript - '安卓 :name' in <activity> tag must be a valid Java class name in React Native

reactjs - Next.js 在 router.push 时保持状态或发送 props

javascript - 我有数组列表,我想渲染它。 react +还原

node.js - 无法运行 eletrode 应用程序获取错误