I have a reducer which looks like this:
export default function reducer(state={
fetching: false,
}, action) {
switch (action.type) {
case 'LOGIN_REQUEST': {
return {...state, fetching: true}
}
...
return state
I dispatch action to it from compoenent and in component I have:
const mapStateToProps = (state) => {
return state
}
My problem is:
1. In mapStateToProps state contains login.fetching: true
2. In component right after dispatching action to reducer this.props.login.fetching contains false.
3. In component render() method this.props.login.fetching is true.
Why in case 2. it is still false, is it possible and what I am missing here?
Action dispatch:
onLoginPress = () => {
this.props.dispatch(loginUser(this.state.email.trim(), this.state.password.trim()))
console.log(this.props);