Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Or lit -

<button @click=${fetch(‘/clicked’)}>



This is way too much magic, starting to look like Vue or Svelte


That's because lit templates are in template strings, so passing through a function requires the dollar sign and curly braces (that's just vanilla js). Everything else about it in the example, aside from using @click instead of onclick, is identical to react.


Yeah even @event is just a shortcut - you can just use this.shadowRoot.addEventListener(‘click’, this.onClickHandler) if you prefer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: