Hacker News new | past | comments | ask | show | jobs | submit login

I'm curious what is bad about it?

Not in an "I don't believe you" way, but in a "I would love to know what would improve it." Starting to push to clean up some web pages I've been close to at work, finally.




Not OP, but some patterns instantly stood out -

  * The use of `useCallback` is confusing in the demo code and is entirely unnecessary.
  * Inconsistent use of single/double quotes and {}'s for literal values.
  * Non-idiomatic combination of JSX elements + raw HTML in strings [1]
[1] e.g. https://unovis.dev/gallery/view?collection=Lines%20and%20Are...


All valid, but the thing that stood out to me most besides useCallback being weirdly inlined—and this is more important IMO—is how awkward everything around labels is. Surely there could be a base labels component that just takes `data`, or at least doesn’t require so much ceremony around the vanilla interface.

The Svelte and vanilla examples are almost identical, but the Angular example looks much more like I’d expect, which strongly suggests (to me) that this is an Angular library with support for other uses bolted on as an afterthought.

That’s all fine, but it probably won’t get much non-Angular adoption if there’s no further effort to make it feel somewhat more idiomatic in other environments. Even if it looks quite nice otherwise (which at a glance it does!).


I assumed the was just directionally wise? That is, it is clearly useless here, as there are no "dependencies" passed; but in a real app you almost certainly have something there.

Still digesting the rest. I'm curious why the mix of raw HTML. (Not in why it is a bad idea, but why it was felt necessary.)


In this specific case, having useCallback makes the demo code more complex and is unrelated to the actual concept being demo'ed to the reader. It's unwise to add unnecessary complexity if it doesn't add clarity.

More generally, adding useCallback is even directionally wrong unless you know _exactly_ why you need it ("for identity" is OK, "for performance" is almost always misguided because the cost of creating a closure is negligible).


Wouldn't you want it to be "dependent" on whatever the source of the data is?




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: