const mapDispatchToProps = dispatch => ({
getUsers: (payload) => dispatch({ type: "USERS", payload: payload })
});
const mapStateToProps= state => ({
ctr: state.TestReducer,
users: state.Users
})
const Dashboard = (props) => {
axios.get("https://jsonplaceholder.typicode.com/users")
.then(function(response) {
props.getUsers(response.data);
});
return (
<h1>hello dashboard</h1>
)
}
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard);
When I add the Users reducer in mapStateToProps, in browser console reducers from redux logger are executing infinitely as shown here enter image description here
I want to store the Users that I get from axios to the User reducer. And those users I want to access using state in mapStateToProps so that I can use as props users. But the problem is redux logger infinitely logs state in my web browser console as shown in the image.
How to stop this?
I tried many ways but did not find a proper solution.


