replace react-use with use-debounce
this is a much lighter dependencie
This commit is contained in:
parent
3dae5b5c04
commit
bb49f6e151
3 changed files with 19 additions and 193 deletions
|
@ -1,5 +1,5 @@
|
|||
import React, { useState, useMemo, useCallback, useRef } from 'react';
|
||||
import { useDebounce } from 'react-use';
|
||||
import { useDebounce } from 'use-debounce';
|
||||
import { useQuery } from 'react-query';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
|
@ -41,7 +41,7 @@ function ComboSearch({
|
|||
);
|
||||
const initialValue = hiddenValueField && hiddenValueField.value;
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState('');
|
||||
const [debouncedSearchTerm] = useDebounce(searchTerm, 300);
|
||||
const [value, setValue] = useState(initialValue);
|
||||
const resultsMap = useRef({});
|
||||
const setExternalValue = useCallback((value) => {
|
||||
|
@ -64,14 +64,6 @@ function ComboSearch({
|
|||
}
|
||||
});
|
||||
|
||||
useDebounce(
|
||||
() => {
|
||||
setDebouncedSearchTerm(searchTerm);
|
||||
},
|
||||
300,
|
||||
[searchTerm]
|
||||
);
|
||||
|
||||
const handleOnChange = useCallback(
|
||||
({ target: { value } }) => {
|
||||
setValue(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue