react课程小demo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
572 B

import React, { Component } from 'react';
import {connect} from 'react-redux';
import ACTIONS from '../../redux/action';
class OperatorButton extends Component {
state = { }
render() {
return (<button onClick={() => this.props.choose_operation(this.props.operator)}>{this.props.operator}</button>);
}
}
const mapDispatchToProps = {
choose_operation: operator => {
return {
type: ACTIONS.CHOOSE_OPERATION,
operator: operator,
}
}
};
export default connect(null,mapDispatchToProps)(OperatorButton);