我正在尝试在 react-native 应用程序中使用 redux-connect。我已经在应用程序的其他部分连接工作,但我正在尝试找出一个问题。
当我导入包含连接的函数 (NewConnect.js) 并调用它时,我收到以下错误:
TypeError: (0, _NewConnect.default) is not a function. (In '(0, _NewConnect.default)()', '(0, _NewConnect.default)' is an instance of Object)
进程相册.js
import NewConnect from './NewConnect';
export async function processAlbum(albumtracks, albumartist) {
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);