refactor(react): useId
This commit is contained in:
parent
1a5d86a32a
commit
4a7324951b
3 changed files with 5 additions and 6 deletions
|
@ -5,6 +5,7 @@ import React, {
|
|||
useContext,
|
||||
createContext,
|
||||
useEffect,
|
||||
useId,
|
||||
useLayoutEffect,
|
||||
MutableRefObject,
|
||||
ReactNode,
|
||||
|
@ -18,7 +19,6 @@ import {
|
|||
ComboboxOption,
|
||||
ComboboxPopover
|
||||
} from '@reach/combobox';
|
||||
import { useId } from '@reach/auto-id';
|
||||
import '@reach/combobox/styles.css';
|
||||
import { matchSorter } from 'match-sorter';
|
||||
import { XIcon } from '@heroicons/react/outline';
|
||||
|
@ -89,7 +89,8 @@ export default function ComboMultiple({
|
|||
const [term, setTerm] = useState('');
|
||||
const [selections, setSelections] = useState(selected);
|
||||
const [newValues, setNewValues] = useState<string[]>([]);
|
||||
const inputId = useId(id);
|
||||
const internalId = useId();
|
||||
const inputId = id ?? internalId;
|
||||
const removedLabelledby = `${inputId}-remove`;
|
||||
const selectedLabelledby = `${inputId}-selected`;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import React, { useState } from 'react';
|
||||
import React, { useState, useId } from 'react';
|
||||
import { fire } from '@utils';
|
||||
import type { Feature } from 'geojson';
|
||||
import { PlusIcon, LocationMarkerIcon } from '@heroicons/react/outline';
|
||||
import { useId } from '@reach/auto-id';
|
||||
import CoordinateInput from 'react-coordinate-input';
|
||||
|
||||
export function PointInput() {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import React, { useState } from 'react';
|
||||
import React, { useState, useId } from 'react';
|
||||
import { Popover, RadioGroup } from '@headlessui/react';
|
||||
import { usePopper } from 'react-popper';
|
||||
import { MapIcon } from '@heroicons/react/outline';
|
||||
import { Slider } from '@reach/slider';
|
||||
import { useId } from '@reach/auto-id';
|
||||
import '@reach/slider/styles.css';
|
||||
|
||||
import { LayersMap, NBS } from './styles';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue