import React, { Dispatch, SetStateAction, useRef, useEffect } from 'react' export const SearchInput = ({ inputValue, setInputValue, placeholder, isActive, }: { inputValue: string setInputValue: Dispatch> placeholder: string isActive: boolean }) => { const inputRef = useRef(null) // Focus on the input when isActive useEffect(() => { if (isActive && inputRef.current) { inputRef.current.focus() } }, [isActive]) const handleInputChange = (event: React.ChangeEvent) => { setInputValue(event.target.value) } return (
) }