79770413

Date: 2025-09-20 16:11:55
Score: 1
Natty:
Report link

If you want to set a timestamp once when items change, do it outside map, like:

const timestamp = useMemo(() => Date.now(), [items]);

const processedItems = useMemo(() => {
  return items.map(item => ({
    ...item,
    processed: true,
    timestamp,
  }));
}, [items, timestamp]);
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Dhirav Patel