replace useUniqueId() with useId()

there should only be one way to do a thing...
This commit is contained in:
David Lechner
2022-05-18 17:16:32 -05:00
parent a005992a21
commit 325562996b
4 changed files with 7 additions and 25 deletions
-18
View File
@@ -1,18 +0,0 @@
// helper functions for React components
import { useState } from 'react';
import { createCountFunc } from './iter';
const nextId = createCountFunc();
/**
* React hook to get a unique identifier, e.g. for linking components via
* aria-labelledby.
*
* @param prefix A namespace prefix for the identifier.
* @returns A unique identifier in the form "prefix-N"
*/
export const useUniqueId = (prefix: string): string => {
const [uniqueId] = useState(`${prefix}-${nextId()}`);
return uniqueId;
};