How to Access the State in setTimeout Inside a React Function Component

useState, setTimeout, useEffect, useRef, and more

Photo by the author, Hydra island

This article looks at the challenge of reading the current state value inside a callback for setTimeout or setInterval utility functions.

useState

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store