This is part on my mini series("How to AlpineJS") on how to build reusable component that can be used in any web framework.
Auto dismissing alert
[!Tip]
Any arguments you pass after the duration forsetTimeout
will be passed to the callback function. In the code snippet above, we passed$this.root
magic property so that we can auto dismiss it after 5000ms(5 seconds)
Next: Multipurpose TextField
Top comments (0)