Props(Properties)
The props in Atomico are the way to associate the webcomponent properties and reactive attributes that trigger the logic or interface of the webcomponent.
Syntax
import { c } from "atomico";
const props = {
// Simple statement
value1: String,
// Structured statement
value2: {
type: String,
reflect: true,
attr: "advaceprop",
value: "default string",
event: {
type: "UpdateAdvanceProp",
bubbles: true,
},
},
};
const MyComponent = c((props) => <host>{props.value1}</host>, { props });
customElement.define("web-component", MyComponent);Consider that:
Simple statements
Structured declaration
Prop.type
Type
Supports reflect
Prop.reflect
Prop.event
Prop.value
Reactivity in the scope of the webcomponent
Recommended articles
Is it advisable to declare events using the props API?Value cycle as propLast updated
Was this helpful?
