Magas
Magas

Reputation: 514

Error: Check the render method with react-redux connect()

I'm trying to learn redux with react-native, so I did some examples, but for everyone, even though they are different, I'm getting the same error.

enter image description here

My code is like this:

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/components/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/store/index.js:

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

export const Store = createStore(Reducers);

The rest I believe they do not have to deal with the problem but if I need to put the code.

Upvotes: 1

Views: 1004

Answers (1)

Gaudam Thiyagarajan
Gaudam Thiyagarajan

Reputation: 1052

There is no <Input type='text' /> tag in react native. There is only a <TextInput /> tag.

Upvotes: 1

Related Questions