function SearchInput({ messages }) { const [filter, setFilter] = useState(""); return ( <> <input value={filter} onChange={(e) => setFilter(e.target.value)} /> {messages .filter((message) => message.includes(filter)) .map((message, idx) => ( <div key={idx}>{message}</div> ))} </> ); }