// ref for focus dinamically const search = useRef(null); ... ... if(search.current?.focus) search.current?.focus();