Remix.run Logo
teaearlgraycold 7 hours ago

Worse still is the misunderstanding that React is simple. It’s an endless stream of cache invalidation bugs. Linters are getting better at catching these. But they also have false positives.

tiborsaas 5 hours ago | parent [-]

What is cache in this context? useState? What do you mean by cache invalidation in react apps?

azangru 5 hours ago | parent [-]

Stale closures, perhaps.

danabramov 4 hours ago | parent [-]

It never happens if you enable the lint rule.

azangru 3 hours ago | parent [-]

I remember how react team's message, around the time hooks were introduced, was how hooks were going to save us from the tyranny of `this`, which people presumably found confusing.

I often think back to that message, while adding things in a dependency array. Especially those things that I know won't change (e.g. the redux `dispatch` function pulled from the context), but the linter doesn't. Or while being admonished by the linter for reading from a ref, or writing to it.