title: How to showing alert to user when login failed in React native with redux
body: <p>There is <code>LOGIN</code> button which has <code>onPress = this.props.onPressLogin(this.state.email, this.state.password)</code> in component. </p>
  
  <p>The <code>onPressLogin</code> in-directly called action generator, <code>loginAct</code>.</p>
  
  <pre><code>const mapDispatchToProps = (dispatch) =&gt; {
      return {
          onPressLogin: (email, password) =&gt; {
              dispatch(loginAct(email, password))
          }
      }
  };
  </code></pre>
  
  <p>The <code>loginAct</code> is actually kind of <strong>thunk</strong>, which return async function and finally its callback generate action.</p>
  
  <pre><code>exports.loginAct = (email, password) =&gt; {
      return function (dispatch) {
          return axios.post('http://10.0.2.2:3000/login', { email: email, password : password })
              .then((response) =&gt; {
                  if(response.data.result == 'success') {
                      dispatch(authUser(email));
                  } else {
                      // I want to show alert to user.
                      dispatch(alertUser(response.data.message));
                  }
              })
              .catch(function (error) {
                  throw error;
              })
      };
  }; 
  
  
  alertUser = (alert) =&gt; {
      return {
          type: 'ALERT_USER',
          alert
      }
  };
  </code></pre>
  
  <p>At this point I don't know how to alert user properly. Is this proper way? I do that if <code>ALERT_USER</code> action generated its reducer handle this </p>
  
  <pre><code>    case 'ALERT_USER' :
          return {
              sysAlert : action.alert
          };
  </code></pre>
  
  <p>And in component, </p>
  
  <pre><code>    if(this.props.sysAlert != ''){
          Alert.alert(
              'Alert title',
              this.props.sysAlert)
      }
  </code></pre>
  
  <p>This way looks like working but I am not sure proper way. After alert, the this.props.sysAlert is not empty, so every time when component moved the empty alert shown. I don't know how to set default to <code>this.props.sysAlert</code>. </p>
  
  <p>Should I create <code>CLEAR_ALERT</code> action? so when Alert window disappear, then clean <code>sysAlert</code> in redux store? It is very complicated I think, Any better idea? </p>