useTimeout() React Hook
Published in
2 min readNov 29, 2019
Working with time effects in React is hard. For example, building countdown components is incredibly easy to do wrong if the React component lifecycle is used incorrectly (but can be easy, if you get a useTime hook!).
The same difficulty goes for integrating delayed callbacks into the React lifecycle. We’re going to wrap setTimeout in a React Hook. In this article, we’re going to discuss: