I have an action configured but it seems like not being added as a props method.
const TIME_UNTIL_REDIRECT = 3000;
const Logout = (props) => {
console.log(props);
useEffect(() => {
const timer = setTimeout(() => {
// props.logout();
props.history.push('/');
}, TIME_UNTIL_REDIRECT);
return () => {
clearTimeout(timer);
};
}, []);
return (
<div className = {CSSModule.Logout}>
<div>You have been logged out.</div>
<div>Redirecting to main page. Please wait...</div>
<div><LoadingSpinner /></div>
</div>
);
};
const mapDispatchToProps = dispatch => ({
logout: () => dispatch(actions.logout())
});
export default connect(null, mapDispatchToProps)(withRouter(Logout));
The output of the first command, console.log(props) contains only history, match, location (see below).
Expected props to also contain the logout function, but actual outcome is props does not contain the logout function.