import React from 'react'; import { useForm, SubmitHandler } from 'react-hook-form'; interface SearchBarProps { handler: (searchText: SearchInputs) => void; placeholder?: string; } interface SearchInputs { search: string; } const SearchBar: React.FC = ({ handler, placeholder = 'Search', }) => { const { register, handleSubmit } = useForm({ defaultValues: { search: '', }, }); const onSubmit: SubmitHandler = (data) => { handler(data); }; return (
^
); }; export default SearchBar;