// ref for focus dinamically const search = useRef<any>(null); ... <input ref={search}/> ... if(search.current?.focus) search.current?.focus();