Advertisement
Zlends

Untitled

Mar 28th, 2024
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. game bet
  2.  
  3. useEffect(() => {
  4.     const timer = setTimeout(() => {
  5.       const newData = data.map((el) => {
  6.         const randomValue = Math.random() * 1;
  7.         const newValue = Math.random() < 1 ? Number(el.oddUI) + randomValue : Number(el.oddUI) - randomValue;
  8.         const roundedValue = Math.round(newValue);
  9.         const newItem = { ...el, oddUI: roundedValue.toString() };
  10.  
  11.         return newItem;
  12.       });
  13.  
  14.       setData(newData);
  15.     }, 2000);
  16.  
  17.     return () => clearTimeout(timer);
  18.   }, [data]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement