在像下面这样的功能性反应组件中,您如何访问从 redux 存储发送过来的道具,类似于如何访问类组件的this.propsin componentDidMount(),如下面的评论所示?
import React from 'react';
import { connect } from "react-redux";
import * as actions from "../../actions";
const ComponentName = () => {
// componentDidMount() {
// this.props;
// }
return (
<div>
<div>???</div>
</div>
);
};
function mapStateToProps(state) {
return { state };
}
export default connect(mapStateToProps, actions)(ComponentName);
开心每一天1111
相关分类