Is it advisable to declare events using the props API?
It is not recommended to use the props API to create an event, as this callback associated as props will have the following limitations:
We recommend:
When is it recommended to use a callback as a prop?
const MyForm = c(
({ getPosts }) => {
const posts = useAsync(getPosts, []);
return <host></host>;
},
{
props: {
getPosts: {
type: Function,
value: async (): Promise<{ id: number; title: string }[]> => [],
},
},
}
);Last updated
Was this helpful?
