小编Mar*_*mon的帖子

如何在 Formik 文本字段上添加清除按钮

我想添加一个清除按钮以方便用户:

constructor(props) {
    this.emailInput = React.createRef();
}

<Field label="Email" name="email" ref={this.emailInput} onChange={onChange} component={TextField}/>
Run Code Online (Sandbox Code Playgroud)

但是得到这个:

Warning: Function components cannot be given refs. Attempts to access this ref will fail.

ref reactjs formik

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

formik ×1

reactjs ×1

ref ×1