Live data from Hacker News

Metaphysics and JavaScript

docs.google.com

31–34 of 34 posts

Re: Metaphysics and JavaScript

#31
post #30
post #17

Earlier quoted context omitted.

To add insult to injury it's fairly easy to use hooks wrong - and used wrong they are, which suggests that their learning curve is not as friendly as proponents of this pattern would wish.

Could you share some examples of hooks used wrongly in code?

useCallback used as something else than a provider of callback functions, e.g. for rendering.

Example:

  const renderItem = useCallback(() => , []);
And then:

  return renderItem();
What should have been used here is useMemo.

Re: Metaphysics and JavaScript

#32
It’s exhausting that the author of Svelte has to continually compare his project to React. It’s a huge red flag when someone can’t substantiate why something is worthwhile without criticizing adjacent projects.

I understand that React is the front-end framework du jour, but React nor any other successful project got where it is by continually criticizing others’ work.

Re: Metaphysics and JavaScript

#33
post #12
post #9

Earlier quoted context omitted.

For what it's worth: to me Svelte is, for the lack of a better word, "better" React. It's another evolutionary step in the same direction. I wouldn't compare it to Angular. Svelte is both easier to use (productivity) and generates faster code. To me React is 2 things: components (reusable pieces that combine state with rendering logic in JavaScript / HTML / CSS) and reactivity (rebuilding UI from state). Virtual DOM…

Too bad https://github.com/sveltejs/svelte/issues/1639 is still open :)

For others who are curious, this is about TypeScript support in Svelte - an issue created a year ago.

The following comment by the author sounds hopeful, that they've been working in that direction, and eventually it will happen:

https://github.com/sveltejs/svelte/issues/1639#issuecomment-...

Re: Metaphysics and JavaScript

#34
post #13

This is a very good take. DOM as a function of state has real tradeoffs but also real benefits; state as a function of state just gets out of hand. IMO React Hooks are where React jumped the shark. setState and Redux were already clunky and felt too rooted in unhelpful ideals, but hooks just took the cake. My company's codebase uses MobX for all state and I highly recommend it. It embraces mutability and imperative c…

Glad to see there's a vocal minority who disagree with the way React Hooks are implemented. I raised my objections when it was announced (even got super kind feedback from Dan Abramov himself) - but it was too late, they "jumped the shark", as you put it. I looked up the meaning of the phrase, not sure it's totally suitable for this situation - but I feel that React crossed a threshold with its release.

I started considering alternative view libraries from that point, and continued to resist against using Hooks in my own React-based projects. The thing is, I love how React transformed web development, it's got huge mind share in the community, and there's nothing better out there yet. I just wish it had stayed small and simple, kept other concerns out of it and focused on doing its one thing only.

Post reply on HN