Skip to content

Instantly share code, notes, and snippets.

@julesjanssen
Created April 23, 2018 21:23
Show Gist options
  • Save julesjanssen/169be8004b44f0a09a9e0d2f33014b25 to your computer and use it in GitHub Desktop.
Save julesjanssen/169be8004b44f0a09a9e0d2f33014b25 to your computer and use it in GitHub Desktop.
dl-hello component
import { Component, State } from '@stencil/core'
@Component({
tag: 'dl-hello',
})
export class DlHello {
@State() booleanState: boolean = true
componentDidLoad() {
setInterval(() => {
this.booleanState = ! this.booleanState
}, 4000)
}
render() : JSX.Element {
if (this.booleanState) {
return (
<div class="yes">
<p>lorem yes</p>
<slot name="first"></slot>
<slot name="second"></slot>
</div>
)
}
return (
<div class="no">
<slot name="second"></slot>
<slot name="first"></slot>
<p>lorem no</p>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment