Skip to content

Instantly share code, notes, and snippets.

@jdnichollsc
Created November 27, 2019 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdnichollsc/55327c8f7ac06ee1cc28fedbd23c4eb8 to your computer and use it in GitHub Desktop.
Save jdnichollsc/55327c8f7ac06ee1cc28fedbd23c4eb8 to your computer and use it in GitHub Desktop.
Using HOC with StencilJS
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