You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functional components can be registered and consumed just like normal components. If you pass a function as the first argument to `h()`, it will be treated as a functional component.
Functional Components can be typed based on whether they are named or anonymous. Volar will warn you if you are not using the right props. It will show you the right types for events that are emitted by them if you are using the right name.
735
+
Functional Components can be typed based on whether they are named or anonymous. Volar also supports type checking properly typed functional components when consuming them in SFC templates.
736
736
737
737
**Named Functional Component**
738
738
739
-
740
739
```tsx
741
-
importtype { SetupContext } from"vue";
742
-
740
+
importtype { SetupContext } from'vue'
743
741
typeFComponentProps= {
744
-
message:string
742
+
message:string
745
743
}
746
744
747
745
typeEvents= {
748
-
sendMessage(message:string):void
746
+
sendMessage(message:string):void
749
747
}
750
748
751
-
function FComponent(props:FComponentProps, context:SetupContext<Events>) {
0 commit comments