useRef we can create and update a single mutable value that exists for the lifetime of the component instance.
After assigning the ref to a variable, we use
.current to access the mutable value.
In this example, we store the return value of
setInterval, which is an interval id, so that we can later call
We'll see more examples of
useRefin the Animated API section.
Want to learn React Native in-depth?