Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useref

function TextInputWithFocusButton() {
 const inputEl = useRef(null);
 const onButtonClick = () => {
    inputEl.current.focus();
  };
return (
    <>
      <input ref={inputEl} type="text" />
      <button onClick={onButtonClick}>Focus</button>
    </>
  );
}
Source by dmitripavlutin.com #
 
PREVIOUS NEXT
Tagged: #useref
ADD COMMENT
Topic
Name
3+8 =