1/** 2 * Copyright (c) 2023 Gitpod GmbH. All rights reserved. 3 * Licensed under the GNU Affero General Public License (AGPL). 4 * See License.AGPL.txt in the project root for license information. 5 */ 6 7import { useState } from "react"; 8 9let currentId = 0; 10const getId = () => currentId++; 11 12//TODO: Replace this with React.useId once we upgrade to v18 13export function useId({ prefix = "el" } = {}) { 14 const [id] = useState(getId); 15 16 return `${prefix}_${id}`; 17} 18 19