Title: Dependency Array Issue in useMemo in Assignment2 Component
Description:
I noticed an issue in the Assignment2 component where the sentences array is included in the dependency array for useMemo. Since the sentences array is not updated anywhere in the code, it should not be part of the dependency array.
Current Code:
const filteredSentences = useMemo(() => {
return sentences.filter(x => x.includes(filter));
}, [sentences, filter]);
Suggested Correction:
const filteredSentences = useMemo(() => {
return ALL_WORDS.filter(x => x.includes(filter));
}, [filter]);