import { useMemo } from 'react';

const useUniqueId = () => {
  const id = useMemo(() => {
    const chars = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789';
    let result = '';

    for (let i = 0; i < 8; i++) {
      result += chars.charAt(Math.floor(Math.random() * chars.length));
    }

    return result;
  }, []);

  return id;
};

export default useUniqueId;
