import { useState } from "react";
function SearchBar({ searchText, onSearchTextChange }) {
return (
<form>
<input
type="text"
value={searchText}
placeholder="Search..."
onChange={(e) => onSearchTextChange(e.target.value)}
/>
</form>
);
}
export default function App() {
const [searchText, setSearchText] = useState("");
return (
<>
<SearchBar searchText={searchText} onSearchTextChange={setSearchText} />
<p>{searchText}</p>
</>
);
}