错误:使用react-redux connect()检查render方法

时间:2018-05-25 21:09:19

标签: react-native redux react-redux

我正在尝试使用react-native来学习redux,所以我做了一些例子,但是对于每个人来说,即使它们不同,我也会遇到同样的错误。

enter image description here

我的代码是这样的:

index.js

import { AppRegistry } from 'react-native';
import App from './src/app';

AppRegistry.registerComponent('reduxExample', () => App);

的src / app.js

import React, { Component } from 'react';
import { Provider } from 'react-redux';

import { Store } from './store';
import Home from './components/home';

export default props => (
  <Provider store={Store}>
    <Home />
  </Provider>
)

的src /组件/ home.js

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { View, Text, Button, Input } from 'react-native';

class Home extends Component {
  render() {
    const { newValue } = this.props;

    return (
      <View>
        <Input type='text' />
        <Button>
          Click me!
        </Button>
        <Text>{newValue}</Text>
      </View>
    );
  }
}

const mapStateToProps = store => ({
  newValue: store.clickState.newValue
});

export default connect(mapStateToProps)(Home)

SRC /存储/ index.js

import { createStore } from 'redux';
import { Reducers } from '../reducers';

export const Store = createStore(Reducers);

其他我认为他们不必处理问题,但如果我需要放置代码。

1 个答案:

答案 0 :(得分:1)

反应原生中没有<Input type='text' />标记。只有<TextInput />标记。