Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

asynch action redux

const handleAsync = () => {
  return function(dispatch) {
    dispatch(requestingData())

    setTimeout(function() {
      let data = {
        users: ['Jeff', 'William', 'Alice']
      }
      // Dispatch received data action here(just a placeholder for API)
      
        dispatch(receivedData(data))
    }, 2500);
  }
};
 
PREVIOUS NEXT
Tagged: #asynch #action #redux
ADD COMMENT
Topic
Name
5+8 =