UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

10 lines (9 loc) 329 B
import { useRef } from 'react'; var counter = 0; export function generateUniqueId(prefix) { return "" + (prefix ? prefix : '') + counter++ + "-" + Date.now() + "-" + Math.round(Math.random() * 10000); } export function useUniqueId(prefix) { var uniqueId = useRef(generateUniqueId(prefix)).current; return uniqueId; }