我使用react-final-form创建了一个表单。自动对焦不起作用。我所知道的唯一解决方案是使用React的ref特性。我可以使用react-final-form库自动聚焦输入吗?
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"));发布于 2019-02-05 22:44:14
用大写的F,autoFocus,解决了我的问题。
https://stackoverflow.com/questions/54536589
复制相似问题