Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code example 4 in "Unopinionated comparison of Glimmer and React" Raw
<button onclick={{action setRandomAnimal}}>
{{yield}}
</button>
function AnimalButton(props) {
...
return (
<button onClick={setRandomAnimal}>
{props.children}
</button>
);
}
<AnimalButton @onAnimalPicked={{action addAnimalToList}}>
Set Random Animal
</AnimalButton>
function RandomAnimal() {
return (
<AnimalButton onAnimalPicked={this.addAnimalToList}>
Set Random Animal
</AnimalButton>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment