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"));