...
import { connect } from "react-redux";
import { AuthActions } from "./actions";
import { bindActionCreators } from "redux";
...
class LoginComponent extends Component {
onLogin() {
this.props.actions.authentication(true, response => {
// ...
});
}
...
render() {
// ... render action onLogin() function when button onPress
}
}
const mapStateToProps = state => {
return {};
};
const mapDispatchToProps = dispatch => {
return { actions: bindActionCreators(AuthActions, dispatch) };
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(LoginComponent);
在actions.js上
...
export const authentication = (login, callback) => dispatch => {
// call api and dispatch action case
// ...
};
当我按下按钮时,显示此错误