Chore: Move useUniqueId to a general place (#69542)

* Move useUniqueId to a general place

* Use new built-in useId hook
This commit is contained in:
ismail simsek
2023-06-05 15:38:54 +03:00
committed by GitHub
parent 8914b8b96f
commit 97221595c1
8 changed files with 15 additions and 63 deletions

View File

@@ -1,8 +1,6 @@
import React, { useRef, useState } from 'react';
import React, { useId, useRef, useState } from 'react';
import { useEffectOnce } from 'react-use';
import { useUniqueId } from 'app/plugins/datasource/influxdb/components/useUniqueId';
export interface Props {
children: React.ReactNode | (({ isInView }: { isInView: boolean }) => React.ReactNode);
width?: number;
@@ -12,7 +10,7 @@ export interface Props {
}
export function LazyLoader({ children, width, height, onLoad, onChange }: Props) {
const id = useUniqueId();
const id = useId();
const [loaded, setLoaded] = useState(false);
const [isInView, setIsInView] = useState(false);
const wrapperRef = useRef<HTMLDivElement>(null);