jaredpalmer/formik

Use React.forwardRef in <Formik>

Open

#2,208 创建于 2020年1月14日

在 GitHub 查看
 (14 评论) (4 反应) (0 负责人)TypeScript (2,801 fork)batch import
Component: FormikFocus: TypeScripthelp wanted

仓库指标

Star
 (34,255 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

As of 2.1.2, <Formik> now allows for an innerRef prop. However, we should instead use React.forwardRef + React.useImperativeHandle. This is more intuitive and closer to best practices. The problem though, is that <Formik> takes TypeScript generics for Values and I'm not sure how to express this in with forwardRef. AFAICT, you can't because forwardRef returns a constant and constants can't have generics.

Help?!?!

贡献者指南