DEV Community

Discussion on: Bad ReactJs practices to avoid

Collapse
 
multiwebinc profile image
Mike Robinson • Edited

Instead of uuid, you could use this function that just returns an incrementing integer (guaranteed to be unique and no external dependencies):

var getNextKey = (function(n) {
  return () => ++n;
}(0));
Enter fullscreen mode Exit fullscreen mode