I created a form using react-final-form
. autofocus is not working. The only solution I know is to use ref
feature of React. Can I autofocus the input using react-final-form
library?
import React from "react";
import { render } from "react-dom";
import { Form, Field } from "react-final-form";
const App = () => (
<Form
render={({}) => (
<form>
<Field name="company" component="input" autofocus />
</form>
)}
/>
);
render(<App />, document.getElementById("root"));
Using capital F, autoFocus
, solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With