Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

useUUID.ts

7 lines220 Bytes

1import { useState } from 'react'
2import { uuid } from '@tanstack/form-core'
3​
4/** Generates a random UUID. and returns a stable reference to it. */
5export function useUUID() {
6 return useState<string>(() => uuid())[0]
7}