Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react check if focused

function Input(props) {
  const [hasFocus, setFocus] = useState(false);

  return (
    <input
      {...props}
      onFocus={() => setFocus(true)}
      onBlur={() => setFocus(false)}
    />
  );
}
Source by exogen.github.io #
 
PREVIOUS NEXT
Tagged: #react #check #focused
ADD COMMENT
Topic
Name
5+6 =