Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native Redux - object is not a constructor (evaluating 'new ctor(props context)')

This is a very simple page that is trying to use Redux....see code below.

However Im getting the error object is not a constructor (evaluating 'new ctor(props context)')

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

const mapStateToProps = state => ({
  userId: state.auth.userId,
});

class Message extends Component {
  render() {
    return (
      <View>
        <Text>Text here</Text>
      </View>
    );
  }
}

export default connect(
  mapStateToProps,
  null,
)(Message);
like image 815
james murphy Avatar asked Mar 01 '20 03:03

james murphy


1 Answers

Reset cache work for me:

react-native start --reset-cache

Other solution is use createSwitchNavigator instead createStackNavigator, in your navigator container.

like image 139
Eduardo Henrique Avatar answered Sep 18 '22 11:09

Eduardo Henrique