fix: give svgs unique ids to avoid clash

This commit is contained in:
Jean-Philippe Sirois
2020-09-02 07:38:55 -04:00
parent 59a965911a
commit ae7ebddb1b
7 changed files with 114 additions and 34 deletions
+14
View File
@@ -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