This repository was archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Provider Component
Josh Thomas edited this page Jun 7, 2018
·
2 revisions
import Tunnel from './data/message'; // Import the Tunnel
@Component({
tag: 'my-app',
})
export class MyApp {
@Prop() intro: string = 'Hello!';
@State() message: string = '';
count: number = 0;
componentWillLoad() {
this.increment();
}
increment = () => {
this.count = this.count + 1;
this.message = `${this.intro} ${this.count}`;
}
render() {
const tunnelState = {
message: this.message,
increment: this.increment
};
return (
<div>
<header>
<h1>Stencil App Starter</h1>
</header>
<Tunnel.Provider state={tunnelState}>
<some-child-component/>
</Tunnel.Provider>
</div>
);
}
}