mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 23:44:11 +02:00
fix: give svgs unique ids to avoid clash
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { v4 as uuidV4 } from "uuid"
|
||||
import { useState } from "react"
|
||||
|
||||
export const useId = () => {
|
||||
// Utilize useState instead of useMemo because React
|
||||
// makes no guarantees that the memo store is durable
|
||||
const [id] = useState(() => {
|
||||
return uuidV4()
|
||||
})
|
||||
|
||||
return id
|
||||
}
|
||||
|
||||
export default useId
|
||||
Reference in New Issue
Block a user