uuidv4 implemented for react keys

This commit is contained in:
VividTruthKeeper 2022-06-23 15:18:17 +05:00
parent 43eba72778
commit 1326a6da71
4 changed files with 36 additions and 4 deletions

29
package-lock.json generated
View File

@ -23,6 +23,7 @@
"react-scripts": "5.0.1",
"swiper": "^8.2.4",
"typescript": "^4.7.4",
"uuidv4": "^6.2.13",
"web-vitals": "^2.1.4"
}
},
@ -3883,6 +3884,11 @@
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
"integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"node_modules/@types/uuid": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
},
"node_modules/@types/ws": {
"version": "8.5.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
@ -17051,6 +17057,15 @@
"uuid": "dist/bin/uuid"
}
},
"node_modules/uuidv4": {
"version": "6.2.13",
"resolved": "https://registry.npmjs.org/uuidv4/-/uuidv4-6.2.13.tgz",
"integrity": "sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ==",
"dependencies": {
"@types/uuid": "8.3.4",
"uuid": "8.3.2"
}
},
"node_modules/v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
@ -20718,6 +20733,11 @@
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
"integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"@types/uuid": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
},
"@types/ws": {
"version": "8.5.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
@ -30189,6 +30209,15 @@
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"uuidv4": {
"version": "6.2.13",
"resolved": "https://registry.npmjs.org/uuidv4/-/uuidv4-6.2.13.tgz",
"integrity": "sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ==",
"requires": {
"@types/uuid": "8.3.4",
"uuid": "8.3.2"
}
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",

View File

@ -18,6 +18,7 @@
"react-scripts": "5.0.1",
"swiper": "^8.2.4",
"typescript": "^4.7.4",
"uuidv4": "^6.2.13",
"web-vitals": "^2.1.4"
},
"scripts": {

View File

@ -1,4 +1,5 @@
// Modules
import { v4 as uuidv4 } from "uuid";
// Components
import SectionTitle from "../global/SectionTitle";
@ -58,10 +59,10 @@ const EventsSection = () => {
<div className="events-inner">
<SectionTitle title="События и новости" />
<div className="events-content">
{eventsData.map((evnt, id) => {
{eventsData.map((evnt) => {
return (
<Event
key={id}
key={uuidv4()}
image={evnt.image}
text={evnt.text}
time={evnt.time}

View File

@ -2,6 +2,7 @@
import { Swiper, SwiperSlide } from "swiper/react";
import { Navigation } from "swiper";
import "swiper/css";
import { v4 as uuidv4 } from "uuid";
// Images
import game from "../../images/slider-img.jpg";
@ -39,9 +40,9 @@ const MainSlider = () => {
prevEl: ".slider-prev",
}}
>
{sliderData.map((slide, id) => {
{sliderData.map((slide) => {
return (
<SwiperSlide key={id}>
<SwiperSlide key={uuidv4()}>
<MainSliderSlide
slideImg={slide.slideImg}
slideLink={slide.slideLink}