Copy of View
An entity that accepts a collection of properties and returns an element.
Definition
view SimpleView(age: number, name: string) -> {
<div />
}
// is equivalent to
view AlternateView(name: string, age: number) -> {
<div />
}
// and
type SpreadType {
age: number;
name: string;
}
view SpreadView(...props: SpreadType) -> {
<div />
}
SimpleView.Props; // $Type(age: number, name: string)
AlternateView.Props; // $Type(age: number, name: string)
SpreadView.Props; // SpreadType -> $Type(age: number, name: string)
SimpleView;
// $View<SimpleView.Props, SimpleView()>
// -> $View<$Type(age: number, name: string), SimpleView()>
AlternateView;
// $View<AlternateView.Props, AlternateView()>
// -> $View<$Type(age: number, name: string), AlternateView()>
SpreadView;
// $View<SpreadView.Props, SpreadView()>
// -> $View<SpreadType, SpreadView()>
// -> $View<$Type(age: number, name: string), SpreadView()>Keys
Omit Parentheses
View Composition
Slots
Named Slots
Default Content
Alternate Composition
Slots
Named Slots
Extend or Implement Other Views
Property Type Inheritance
Simple Property Transformation
Partially Apply Properties
Extend and Augment Signature
Extension as an Interface
Nest Super Content
Full view declaration syntax
Create State explicitly (bypass dependency injection)
Partial Context Application
Last updated