"use client"; import { useState } from "react"; import styles from "../styles/search.module.css"; import { FaSearch } from "react-icons/fa"; import SearchResults from "./search_2"; export default function SEARCH_COMPONENT() { const [title, setTitle] = useState(""); const [result, setResults] = useState(null); const fetch_results = async (title) => { setResults(await SearchResults(title)); }; return (
setTitle(event.target.value)} onKeyDown={async (e) => { if ((e.key === "Enter" || e.code === 13) && title) { await fetch_results(e.target.value); } }} >
{result}
); }