Add and document defineFunctionalComponent #530
Replies: 0 comments 3 replies
-
Is that what you are looking for?
Note that you must pass a setup function that returns render function. See also: https://v3-migration.vuejs.org/breaking-changes/functional-components.html#_3-x-syntax |
Beta Was this translation helpful? Give feedback.
-
Close but not quite—
https://vuejs.org/guide/extras/render-function.html#functional-components |
Beta Was this translation helpful? Give feedback.
-
What about slots passed to the functional components? I feel that the API should also cover that, like so: // MyComponent.ts
import { h, defineFunctionalComponent } from 'vue'
export type MyComponentProps = { ... }
export type MyComponentEmits = { ... }
export type MyComponentSlots = { ... }
export default defineFunctionalComponent<MyComponentProps, MyComponentEmits, MyComponentSlots>(
(props, ctx) => h(...)
) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What problem does this feature solve?
Defining type-safe functional components is more difficult than normal components, because:
FunctionalComponent
type is undocumenteddefineFunctionalComponent
helperWhat does the proposed API look like?
Beta Was this translation helpful? Give feedback.
All reactions