Check out example codes for "Execute code every x seconds with Update()". It will help you in understanding the concepts better.

Code Example 1

private float nextActionTime = 0.0f;
 public float period = 0.1f;
 
 void Update () {
     if (Time.time > nextActionTime ) {
        nextActionTime += period;
         // execute block of code here
     }
 }

Learn ReactJs, React Native from akashmittal.com