我是React-redux应用程序开发的新手,我试图了解如何在页面加载后立即发送另一个操作.以下是我的容器代码.我正在使用这个(https://github.com/jpsierens/webpack-react-redux)样板.
let locationSearch;
const ActivationPage = ({activateUser}) => {
return (
<div className="container">
<h2>Activation Required</h2>
<p>An Activation Email was sent to your email address. Please check your inbox to find the activation link</p>
{ activateUser() }
</div>
);
};
ActivationPage.propTypes = {
activateUser: PropTypes.func
};
const mapStateToProps = (state) => {
return {
message: state.message,
currentUser: state.currentUser,
request: state.request
};
};
const mapDispatchToProps = (dispatch) => {
return {
activateUser: () => {
console.log(location);
if (location.search !== '') …Run Code Online (Sandbox Code Playgroud)