17
rated 0 times
[
21]
[
4]
/ answers: 1 / hits: 10285
/ 5 Years ago, fri, july 5, 2019, 12:00:00
I have a react-bootstrap
modal with an <input>
. I want to set the autofocus attribute on the <input>
The following works fine, but shows a warning in the console
<input type=text autofocus='true' />
Warning: Invalid DOM property `autofocus`. Did you mean `autoFocus`?
The following options do not work, in the sense that they do not focus the input when opening the modal:
<input type=text autoFocus='true' />
<input type=text autoFocus={true} />
<input type=text autoFocus />
What is the recommended way of setting autofocus. Or how should I mute the warnings for the example that works well?
Note: This is react 16.8.6
More From » reactjs