UNPKG

hm-react-cli

Version:

Create a Huimei React project by module

36 lines (31 loc) 923 B
/* * @Author: zhang peng * @Date: 2021-10-27 10:20:19 * @LastEditTime: 2021-12-06 15:40:21 * @LastEditors: zhang peng */ import { Button } from 'antd'; import { connect } from 'react-redux'; // import Parent from './Parent'; const mapState = (state) => ({ count: state.count }); const mapDispatch = ({ count: { increment, incrementAsync } }) => ({ increment: () => increment(1), incrementAsync: () => incrementAsync(1) }); function ButtonDemo(props) { return ( <div> {props.count} <Button type="primary" onClick={props.increment}> increment </Button> <Button onClick={props.incrementAsync}>incrementAsync</Button> <Button type="ghost">Ghost</Button> <Button type="dashed">Dashed</Button> {/* <Parent /> */} </div> ); } export default connect(mapState, mapDispatch)(ButtonDemo);