Check out example codes for "delay millis arduino". It will help you in understanding the concepts better.

Code Example 1

int delay_ = 500;//my delay will be for 500 miliseconds
int time_;//the name of the variable is time_ because there is a function already called time

void setup(){
time_ = millis();
}

void loop(){
if (millis() - time_ > delay_){
//your code here
time_ = millis();

Code Example 2

int delay = 500;//my delay will be for 500 miliseconds
int time_;//the name of the variable is time_ because there is a function already called time

void setup(){
time_ = millis();
}

void loop(){
if (millis() - time_ > delay){
//your code here
time_ = millis();

Learn ReactJs, React Native from akashmittal.com