How to set props as types not values in form composition #1804
Unanswered
Aymen-Khanfir
asked this question in
Q&A
Replies: 1 comment
-
Sure there is! The props' keys and values are not used, but help with generics properly inferring. You can safely assert it inline: interface MyProps {
patient: PatientResponse | undefined
}
export const PatientFormFields = withForm({
...eventFormOpts,
props: {} as MyProps,
render: function Render({ form, patient }) {
// ...
}
}) The reason you can't add it as, say, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I currently have this code below and i want to know if there is any possible way to use interfaces to type my props instead of setting default values with the withForm hook
Beta Was this translation helpful? Give feedback.
All reactions