Check out example codes for "how to set timeout for a div tag in html". It will help you in understanding the concepts better.

Code Example 1

<script>
  const timeout = document.getElementsByClassName('classname')
  setTimeout(hideElement, 1000) //milliseconds until timeout//
  function hideElement() {
    timeout.style.display = 'none'
</script>
<div class="classname">
  <span> &times; </span>

Learn ReactJs, React Native from akashmittal.com