HNHacker News
TopNewBestAskShowJobs

naught0

60 karma · joined November 3, 2021

https://jamese.dev
submissionscomments
naught0··on Understanding React Compiler
The example supplied is what I was trying to get at.

An empty dependency array means that the effect runs only once on mount. Same with memos and callbacks -- the value should remain stable. Here's a real world example of how I populate some state based on url query params:

https://github.com/Naught0/combinator/blob/master/frontend/s...

I may end up using a more robust routing solution to keep in sync with query params if I ever want to spend the effort, but this is a naive solution that works alright.

A more simplified, generic example could be:

  const [foo, setFoo] = useState();
  useEffect(() => {
    setFoo("bar");
  }, []); // The eslint rule wants setFoo here despite the value being stable
naught0··on Understanding React Compiler
React is the premier frontend framework because it is easy to learn, scales ad infinitum, and has reached a critical mass where the library support is second to none.

Anyone advising juniors against learning React is shooting them in both feet, not least because of the demand for React developers.

naught0··on Understanding React Compiler
Personally, I semi-regularly encounter instances where this rule must be ignored else I achieve an infinite re-render loop. Other times, it can be ignored, like when you use a stable value in the body of the memo or effect, like state setters from `useState`.

In practice this leads to ignoring the rule, disabling the rule with a comment (and potentially forgetting to add vital dependencies when the function is updated), or adding a bunch of unnecessary noise to the dep array.

naught0··on I switched to Vim – and it took me only 6 years to learn it
It sounds like something broken with this specific workflow. I use LSP features in typescript and python daily without issue.

Don't use a tool that's broken for your work. There are plenty of bugs in other editors

naught0··on Htmx, Rust and Shuttle: A New Rapid Prototyping Stack
I mean I use tailwind or a framework like Chakra so yeah, my styling is typed or at the very least has robust editor support
naught0··on Kagi is 80% faster and 70% less carbon intensive than Google
It's a plus to me
naught0··on AI Generated Seinfeld runs 24/7 on Twitch
Isn't television the same, then? Just with fewer creators and a much higher barrier to entry.
← PreviousPage 2 of 2