Skip to main content

idGenerator

Callable

  • idGenerator(): Generator<number, number, unknown>

  • Generator function that creates a unique ID sequence.

    @generator
    @function

    useId

    @yields

    The next unique ID in the sequence.

    @example
    const generateId = useId();
    console.log(generateId.next().value); // 1
    console.log(generateId.next().value); // 2
    console.log(generateId.next().value); // 3

    Returns Generator<number, number, unknown>