import * as React from "react"; const { useState } = React; interface SearchBoxProps { initialValue: string; onSearch: Function; } type ChangeEvent = React.ChangeEvent; type ClickEvent = React.MouseEvent; export const SearchBox = ({ initialValue, onSearch }: SearchBoxProps): JSX.Element => { const [value, setValue] = useState(initialValue || ""); const onChange = (event: ChangeEvent) => { setValue(event.target.value); }; const onClick = (_event: ClickEvent) => { onSearch(value); }; const onClear = (_event: ClickEvent) => { setValue(""); onSearch(""); }; return (
); };