我熟悉Angular并了解React的基础知识.我正在探索模板文档,我发现模板组件有@Component
装饰器和render()
功能 -
component.tsx
import { Component, Prop } from '@stencil/core';
@Component({
tag: 'my-first-component',
styleUrl: 'my-first-component.scss'
})
export class MyComponent {
// Indicate that name should be a public property on the component
@Prop() firstName: string;
render() {
return (
<p>
My name is {this.firstName}
</p>
);
}
}
Run Code Online (Sandbox Code Playgroud)
帮助我理解它与角度和反应有何不同以及它是如何工作的?
reactjs ionic-framework stenciljs stencil-component stencil-compiler