title: React redux update state onClick function with multiple actions
body: <p>I am trying to update redux state, the problem i run into is the mapStateToProps is not being update when onclick function being executed with multiple actions. I know actions are running asynchronously and thats why state is not being update on time. is there away to overcome this issue </p>
  
  <p>code Example </p>
  
  <p>when OnClickFunction is executed, getCase action takes this.props.filters.active_case_page as a page number 
  and nexPage action changes the active_case_page index, but the issue here is that this.props.getCases still has the old value of this.props.filters.active_case_page when getCase action executes</p>
  
  <pre><code>OnClickFunction = () =&gt; {
      this.props.nextPage(this.props.filters.active_case_page);
      this.props.getCases(this.props.filters.active_case_page,'All','dateCreated',false,null,'5a9ee9fa88406eeeebabbd1f')
  }
  
  function mapStateToProps(state){
      return{
          filters: state.doctors.filters,
      }
  }
  
  function mapDispatchToProps(dispatch){
      return bindActionCreators({
  
          nextPage:nextPage,
          getCases:getCases
      },dispatch)
  }
  
  export function nextPage(){
  
      return{
          type:"NEXT_PAGE"
      }
  }
  
  export function getCases(pageNum,filterType,filterOption,isSearchOn,searchText,doctor_id){
  
      return function(dispatch){
          axios.get("/api/getCases/"+pageNum+"/"+filterType+"/"+filterOption+"/"+isSearchOn+"/"+searchText+"/"+doctor_id)
              .then(function(response){
                  dispatch({type:"GET_CASES",payload:response.data});
              })
              .catch(function(err){
                  dispatch({type:"GET_CASES_REJECTED",payload:err});
              })
      }
  }
  
  export function doctorsReducers(state={
      customer_cases:[],
      filters:{
          active_case_page:0,
          selected_cases_filter:'dateCreated',
          filter_options: 'All',
          isCaseSearchOn:false,
          search_cases:'',
      }
  
  }, action){
      switch(action.type){
  
          case "NEXT_PAGE":
          // return the state and copy of boos array from state
              return {
                  ...state,
                  filters:{
                      ...state.filters,
                      active_case_page:state.filters.active_case_page+1,
                  }
  
              }
          break;
  
          case "GET_CASES":
          // return the state and copy of boos array from state
              return {
                  ...state,
                  customer_cases:[...action.payload[0]],
              }
          break;
  
      }
      return state;
  }
  </code></pre>