'How can I write an adapter for my React Final Form component with Typescript?
I need to write an adapter for a component, to which I need to pass certain props. For example, I have a component which can receive certain props as "disabled", but I cannot indicate it in the tag of react form. I need to do this using typescript
In React final Form :
<Field name="email" component={mycomponent}>
</Field>
"mycomponent" is the one I need to be able to pass a prop, for example "disabled"
Solution 1:[1]
All props other than FieldProps are passed down to the component. So you could write:
<Field name="email" component={MyComponent} disabled={true}>
</Field>
than MyComponent would receive disabled prop.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Evgeny Timoshenko |
