Component
Type to structure a component from its creation
import { Component } from "atomico";
// 📌 Parameters for the function and set
// the structure rules for myComponent.props
interface Props{
checked: boolean;
value: string
}
// 📌 Optional, improves the typing experience
// in JSX (Atomico, Preact and React)
interface MetaProps {
myMethod:(value: number)=>void;
onMyEvent: Event;
}
const myComponent: Component<Props, MetaProps> = (props) => {
const myMethod = (value: number)=>{};
return <host myMethod={myMethod }></host>
}
myComponent.props = {
checked: Boolean,
value: { type: String, event: {type: "MyEvent"} },
}Last updated
Was this helpful?
