diff --git a/QandA/frontend/src/SearchPage.tsx b/QandA/frontend/src/SearchPage.tsx index a1b54db..c924eb1 100644 --- a/QandA/frontend/src/SearchPage.tsx +++ b/QandA/frontend/src/SearchPage.tsx @@ -10,6 +10,15 @@ import { searchQuestions, QuestionData } from './QuestionsData'; export const SearchPage = () => { const [searchParams] = useSearchParams(); + const [questions, setQuestions] = React.useState([]); + const search = searchParams.get('criteria') || ''; + React.useEffect(() => { + const doSearch = async (criteria: string) => { + const foundResults = await searchQuestions(criteria); + setQuestions(foundResults); + }; + doSearch(search); + }, [search]); return {null}; };