createRef replace with useRef
This commit is contained in:
parent
23ac00fdff
commit
56e79bffca
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
import React from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { useDebouncedCallback } from 'use-debounce';
|
import { useDebouncedCallback } from 'use-debounce';
|
||||||
import Input from 'components/common/Input/Input';
|
import Input from 'components/common/Input/Input';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
@ -29,7 +29,7 @@ const Search: React.FC<SearchProps> = ({
|
||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const ref = React.createRef<HTMLInputElement>();
|
const ref = useRef<HTMLInputElement>(null);
|
||||||
const handleChange = useDebouncedCallback((e) => {
|
const handleChange = useDebouncedCallback((e) => {
|
||||||
if (ref.current != null) {
|
if (ref.current != null) {
|
||||||
ref.current.value = e.target.value;
|
ref.current.value = e.target.value;
|
||||||
|
|
Loading…
Add table
Reference in a new issue