import { useMemo } from "react";

let count = 0;
const defaults = {
  separator: "::"
};

export function reset() {
  count = 0;
}

export default function useUniqueId(prefix, options = defaults) {
  return useMemo(() => `${prefix}${options.separator}${count++}`, [options.separator, prefix]);
}
