typeError: (0, _reactRedux.connect) is not a function

Viewed 2254

I'm unable to display my react native app because of the error. I have already looked at the other similar post on here, but is did not provide an answer for my question.

below is some code:

import React, {Component} from 'react';
import {View, Text, StyleSheet, Image,TouchableOpacity,Button} from 'react-native';
import TopNavbar from './TopNavbar';
import { connect } from 'react-redux';
import {addIncrement, addDecrement} from '../redux/actions'

class Insigts extends Component {

    componentDidMount(){
        this.props.addIncrement
    }
    render(){
        const { counter } = this.props
        return(
            <View style={styles.container}>
                a lot of other elements etc... 
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        marginTop: 40,
    },
    somestyle: {
      style style style
});


const mapStateToProps = (state) => {
    return {
        counter: state.counter
    }
}

const mapDispatchToProps = (dispatch) => {
    return {
    addIncrement: () => dispatch(addIncrement()),
    addDecrement: () => dispatch(addDecrement()),    
    }
}

export default connect(
    mapStateToProps,
    mapDispatchToProps,
    )(Insigts)

I have installed all the packages and tried restarting the simulator, but without succes.

0 Answers
Related