Skip to content

Instantly share code, notes, and snippets.

@vldvel
Last active February 7, 2019 06:58
Show Gist options
  • Save vldvel/8c6037d1296850fa7c1345e3f9d4f01f to your computer and use it in GitHub Desktop.
Save vldvel/8c6037d1296850fa7c1345e3f9d4f01f to your computer and use it in GitHub Desktop.
update in middleware
const updateMessagesMiddleware = ({ dispatch }) => next => {
const updateMessages = async () => {
await getNewMessages()(dispatch);
setTimeout(updateMessages, 500);
};
updateMessages();
return action => next(action);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment