'React-Native Redux error when invoking connect as a function: TypeError: (0, _function.default) is not a function... is an instance of an object

I am trying to use redux-connect in a react-native app. I have connect working in other parts of the app, but I am trying to figure out an issue.

When I import the connect-containing function (NewConnect.js) and invoke it, I get the following error:

TypeError: (0, _NewConnect.default) is not a function. (In '(0, _NewConnect.default)()', '(0, _NewConnect.default)' is an instance of Object)

processAlbums.js

import NewConnect from './NewConnect';
export async function processAlbum(albumtracks, albumartist) {
  NewConnect();
...
}

NewConnect.js

import React from 'react';
import {connect} from 'react-redux';

function NewConnect() {
  console.log('THIS IS A NEW CONNECT');
}

function mapStateToProps(state) {
  return {
    theme: state.themeReducer.theme,
    duration: state.duration,
  };
}

const mapDispatchToProps = dispatch => {
  return {
    // dispatching plain actions
    increment: payload => dispatch({type: 'INCREMENT', payload: payload}),
  };
};

export default connect(mapStateToProps, mapDispatchToProps)(NewConnect);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source