mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-23 04:19:48 +00:00
Fix bug UI and update variable name
This commit is contained in:
@@ -9,19 +9,19 @@ const StyledSearch = styled.input`
|
||||
`;
|
||||
|
||||
interface ISearch {
|
||||
setKeyPhone: React.Dispatch<React.SetStateAction<string>>;
|
||||
setPhoneSearch: React.Dispatch<React.SetStateAction<string>>;
|
||||
}
|
||||
|
||||
const Search = ({ setKeyPhone }: ISearch) => {
|
||||
const Search = ({ setPhoneSearch }: ISearch) => {
|
||||
const [query, setQuery] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
const timeOut = setTimeout(() => {
|
||||
setKeyPhone(query);
|
||||
setPhoneSearch(query);
|
||||
}, 500);
|
||||
|
||||
return () => clearTimeout(timeOut);
|
||||
}, [setKeyPhone, query]);
|
||||
}, [setPhoneSearch, query]);
|
||||
|
||||
return (
|
||||
<StyledSearch
|
||||
|
||||
Reference in New Issue
Block a user