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

I mean, anybody is free to write how they like on their blog. I just don't find arguments like these convincing without realistic non-trivial examples.


What would a non-trivial example look like to you?

I'm working on building exactly this resource alongside a series of posts on web components.


One example would be a search field that shows suggestions from the server while typing.


Here's a pre-built one that I found that even lets you customize the debounce amount: https://ionicframework.com/docs/api/searchbar#debounce

The Stackblitz example is quite good too.

I'll give it shot to build a super simple one with just vanilla JS without helper libraries like Lit or Stencil. I think I'd take the same approach as I would with React, and I think the biggest difference would be where the fetch gets executed. In React you'd expose a prop like "submitHandler", but here I would emit an event from the component (after whatever debounce amount) and expect the caller to attach an event listener to my custom event to perform the fetch.




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

Search: