码迷,mamicode.com
首页 > 其他好文 > 详细

react random key generator;react如何产生随机不重复的key

时间:2018-12-15 13:40:53      阅读:452      评论:0      收藏:0      [点我收藏+]

标签:www   数组   www.   rand   key   uuid   产生   tor   pack   

1、<div key={+new Date() + Math.random()}>

2、使用数组的索引

3、使用uuid:https://www.npmjs.com/package/uuid

4、使用uniqid:https://www.npmjs.com/package/uniqid

5、Date.now()

react random key generator;react如何产生随机不重复的key

标签:www   数组   www.   rand   key   uuid   产生   tor   pack   

原文地址:https://www.cnblogs.com/shengulong/p/10122759.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!