import React from "react"; import "./searchBar.css"; import { Navigate } from "react-router-dom"; interface SearchBarProps {} interface SearchBarState { redirect: string | undefined; value: string; } export class SearchBar extends React.Component { constructor(props: SearchBarProps) { super(props); this.state = { redirect: undefined, value: "" }; } handleChange = (event: React.ChangeEvent) => { const target = event.currentTarget as HTMLInputElement; this.setState({ value: target.value }); } onSearch = () => { this.setState({ redirect: `/search/${this.state.value}` }); } render() { return (
Search
{this.state.redirect && }

Best{` deals `}of the day

); } } export default SearchBar;