I have an action that updates notification state of my application. Usually, this notification will be an error or info of some sort. I need to then dispatch another action after 5 seconds that will return the notification state to initial one, so no notification. The main reason behind this is to provide functionality where notifications disappear automatically after 5 seconds.
I had no luck with using setTimeout
and returning another action and can't find how this is done online. So any advice is welcome.
You can do this with redux-thunk. There is a guide in redux document for async actions like setTimeout.