小编Tos*_*han的帖子

不变违规:App(...):渲染中没有返回任何内容.这通常意味着缺少return语句.或者,为了不渲染,返回null

这是我在React Native中使用Redux的第一个项目,我有一个组件(MyApp),我在index.js中导入它.但它给出了上述错误.

index.js -

import React from 'react';
import { AppRegistry } from 'react-native';
import MyApp from './component/MyApp';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import  rootReducer from './reducers';
import thunk from 'redux-thunk';

const store = createStore(rootReducer, applyMiddleware(thunk));
const App = () => {
    <Provider store={store}>
        <MyApp/>
    </Provider>
}

AppRegistry.registerComponent('learningRedux', () => App);
Run Code Online (Sandbox Code Playgroud)

MyApp.js

import React, { Component } from 'react';
import {
    Text, View, TouchableHighlight
} from 'react-native';

import { connect } from …
Run Code Online (Sandbox Code Playgroud)

react-native redux react-redux

4
推荐指数
1
解决办法
5158
查看次数

标签 统计

react-native ×1

react-redux ×1

redux ×1