I have a boolean in my component's state that I am using to decide whether an element should be in focus.
I use React.createRef() in the constructor and assign the ref to the <input> through its props. Then in render, I use an if statement to check whether the boolean is true, and call inputRef.current.focus() to bring it into focus if it is. The if statement is being triggered, but the element simply isn't being brought into focus.
Any help would be greatly appreciated!