如何使用 Typescript 为我的 React Final Form 组件编写适配器?

How can I write an adapter for my React Final Form component with Typescript?

我需要为组件编写一个适配器,我需要向其传递某些道具。例如,我有一个组件可以接收某些道具作为“禁用”,但我不能在反应形式的标签中指出它。我需要使用 typescript

在 React 最终形式中:

<Field name="email" component={mycomponent}>
</Field>

“mycomponent”是我需要能够传递道具的组件,例如“disabled”

FieldProps 以外的所有属性都传递给组件。所以你可以写:

<Field name="email" component={MyComponent} disabled={true}>
</Field>

MyComponent 会收到 disabled prop.