Now, the community doesn't know about that. So when you tell them that there's a better way to deal with component state, they immediately get defensive: "No, setState() is way better, there's no magic, it's very explicit".
But setState() was a necessary evil, not a genius invention. They made it super-explicit because it was the only way they could do it. Not because of some great foresight.
Is it bad? Probably not. I bet it's tolerable. But why settle for less when there are better alternatives?
Proxies have been around for at least a decade (here’s a 2010 talk about it
)
React hooks have been around for less than half the time as that.
Proxies for setState would be a terrible idea in React for the simple reason that non state variables also exist in React functional components and have dramatically different behavior than state variables. Proxies would make them both look basically the same after initialization which would lead to a ton of bugs as devs lost track of which variable was a state variable and which one wasn’t.
> Proxies have been around for at least a decade
Having Proxy described in ES5 standard and having it supported in browsers is two different things. IE market share at that time was around 30-40%.
> non state variables also exist in React functional components and have dramatically different behavior than state variables
Stateful functional components were introduced in 2018 (React 16). I'm talking about 2011-2013.