Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react focus textarea

const focusDiv = useRef();

useEffect(() => {
 if(focusDiv.current) focusDiv.current.focus(); 
}, [focusDiv]);

return (
  <div ref={focusDiv}></div>
);
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #react #focus #textarea
ADD COMMENT
Topic
Name
4+3 =