Click Event in...
The use of the click directive is quite similar in these 3 frameworks.
Check it out 🚀
React
const handleClick = () => {
alert('I was clicked!')
}
<button
onClick={handleClick}
className="button">Click me!</button>
Vue
const handleClick = () => {
alert('I was clicked!')
}
<button
@click="handleClick"
class="button">Click me!</button>
Svelte
const handleClick = () => {
alert('I was clicked!')
}
<button
on:click={handleClick}
class="button">Click me!</button>
Top comments (0)