Skip to content

Commit

Permalink
Merge pull request #181 from Giveth/fix/search-input
Browse files Browse the repository at this point in the history
Fix/search input
  • Loading branch information
MohammadPCh authored Oct 3, 2024
2 parents 6d0eac8 + 65edd83 commit 73c41eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/features/home/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import Image from 'next/image';
import { type FC, useState } from 'react';
import { useSearchParams } from 'next/navigation';
import { type FC, useEffect, useState } from 'react';

interface SearchInputProps {
setTerm: (term: string) => void;
}

export const SearchInput: FC<SearchInputProps> = ({ setTerm }) => {
const [value, setValue] = useState<string>();
const searchParams = useSearchParams();

useEffect(() => {
const term = searchParams.get('term');
setValue(term || '');
}, [searchParams]);

return (
<>
<input
Expand Down

0 comments on commit 73c41eb

Please sign in to comment.