I am familiar with Angular and know basics of React. I was exploring stencil docs, I found stencil component has both @Component decorator and render() method -
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>
);
}
}
Help me to understand that how Stencil is different from angular and react and how it works?
Watch the talk of the Ionic team members at Polymer Summit, it explains the purpose of Stencil pretty good.
Basically it is not a framework like Angular or React, it is a compiler which helps you creating spec conform web components which run in every browser that supports web components (or almost any browser using polyfills).
You do not need any framework for using these components, but you can use them also with any framework, which is the huge advantage of web components.
You can't use an Angular component in React but you can use a component created with Stencil with Angular or React or Vue or with no framework at all.