The situation of multiple timers in the react page

the case of multiple timers in the react page, as follows:

list:[
   {
     aimTime:"2018-5-27 10:30:00"
   },
{
     aimTime:"2018-5-27 10:30:00"
   },
{
     aimTime:"2018-5-27 10:30:00"
   }
]


<div className="container">
          {
            this.props.list.map((v, k) => {
              return (
                <div key={k} className="list">
                  
                      // 
                </div>
              );
            })
          }

        </div>

how to achieve non-interference between multiple timers, and what to do when clearing timers?

Mar.13,2021

normal use of setTimeout and setInterval is independent and does not interfere with each other.

as for cleanup, if you want to clear at a fixed point, save the timerID with an object and find the ID to clear according to the key. If you don't have to set a fixed point, an array is saved and then traversed and emptied


I once wrote a tomato clock.
can be routed and switched.
made a special layer of the timer at that time.
on the global


I'm a little confused about your problem, but you can assign a value to a variable when you're on a timer, and then you can clear it when you clear it. If it is about the speed of execution, since settimeout is asynchronous, you can try to solve the problem by


wrapping the timer as a component, which is easier to manage

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3651a-2bfeb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3651a-2bfeb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?