Answer the question
In order to leave comments, you need to log in
How to determine whether an element is focused or not using ref?
Good afternoon!
How to use ref to determine whether an element has focus or not? There is a property setting the focus element this.inputRef.current.focus();
But I still haven't found the property that stores isFocus in itself?
Answer the question
In order to leave comments, you need to log in
const isFocused = document.activeElement === this.inputRef.current;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question