Created
November 27, 2019 01:57
-
-
Save jdnichollsc/55327c8f7ac06ee1cc28fedbd23c4eb8 to your computer and use it in GitHub Desktop.
Using HOC with StencilJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, h } from '@stencil/core'; | |
import { createAnimatableComponent } from '@proyecto26/animatable-component' | |
const HelloWorldButton = (props) => { | |
const { iconName, ...rest } = props | |
return ( | |
<ion-fab-button onClick={() => alert('Hello World')} {...rest}> | |
<ion-icon name={iconName || 'home'} /> | |
</ion-fab-button> | |
) | |
} | |
const AnimatableFirstButton = createAnimatableComponent(HelloWorldButton) | |
const AnimatableSecondButton = createAnimatableComponent(HelloWorldButton) | |
@Component(...) | |
export class PageHome { | |
render() { | |
<ion-content> | |
<AnimatableFirstButton autoPlay animation="bounce" duration={700} iconName="send"></AnimatableFirstButton> | |
<AnimatableSecondButton autoPlay animation="pulse" duration={400}></AnimatableSecondButton> | |
</ion-content> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment