Anonymous functions are not primitive values, so JavaScript passes them as pointers. React uses strict equality when comparing props, so non-primitive values are compared with pointer equality. The useCallback hook allows one to cache anonymous functions in order to pass stable pointers as props and avoid re-renders from pointers changing. It's the exact same motivation as useMemo for passing props with "stable identity".
It’s used in order to prevent redundant rerender to child components.
When passing to a child component a function you’ve created inside functional component it’s get recreated because JS doesn’t keep references to a function created inside a function, thus making your child component rerender because a prop has changed.
This example actually really corresponds with this post comments, the need for useCallback have only emerged after the move from class components, because private methods you create in a class do not get recreated at each render
Prevents some re-renders when passing callbacks down the render chain, but the core flaw in modern day React is that this is added to the developer's list of things to worry about (same as memoization) and manage with the dependency array. It just feels like a lot of things that the framework should deal with and abstract away.
Yeah that's crazy that function pointers cause re-renders in React, I had no idea about this. My go-to reactivity library is SolidJS right now though, their fine-grained reactivity is really nice to work with.
The site's security works fine. But it's mathematically impossible to distinguish malicious from benign traffic in general (extensional equality of procedures is uncomputable), so we use simpler "heuristic" rules, based on our threat models.
You are able to bypass the anti-abuse mechanisms, because it is not worth making them stricter for your sake. If you are annoying enough, you'll get a special dozen-line patch, just for you. This is the most boring, pointless kind of victory I can imagine.
I've got three attacks on the HN anti-abuse mechanisms in my back pocket, but I do not use them: there is as yet no good reason for me to do so, I have better things to do, and I have some respect for other people's time.
You're wrong about the IP bans and accounts. Once dang sees your garbage, you'll be blocked, it's not automatic. SHA1 HMAC has nothing to do with this.
Same weirdness vibe and formating issue too. Ok this is a new account too but I am on another device and did not find my creds on first try. I bet on the advert intention too.
Pro tip: if you don't comment on a spam post and just flag it, it gets flagged dead and people without showdead won't even see it at all (not even as [flagged]). Once you comment on it it sticks around even after being flagged, which gets better visibility for the spam than if you had ignored it.