如何将useFormik
钩子与 ` 一起使用?
我尝试过这个但不起作用
const formik = useFormik({
initialValues: {
healthBackground: [],
},
onSubmit: (values) => alert(JSON.stringify(values)),
});
return (
<formik>
<input type="checkbox" {...formik.getFieldProps("healthBackground")} value="test1" />
<input type="checkbox" {...formik.getFieldProps("healthBackground")} value="test2" />
</formik>
)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6919 次 |
最近记录: |