How to create a stopwatch with redux?

Posted by Prem Tiwari | Updated on

Want to create a stopwatch with redux? This keeps action dispatches to a minimum — only actions to start and stop (and reset) the timer are dispatched. Remember, you’re returning a new state object every time you dispatch an action, and each connected component then re-renders (even though they use optimizations to avoid too many re-renders inside the wrapped components). Furthermore, many many action dispatches can make it difficult to debug app state changes, since you have to deal with all the TICKs alongside the other actions.

Here’s an example:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers