4 ms·
This is ahistorical. Proxies have been around for at least a decade (here’s a 2010 talk about it https://youtu.be/sClk6aB_CPk https://youtu.be/sClk6aB_CPk )
by addicted 4y ago
This is ahistorical.
Proxies have been around for at least a decade (here’s a 2010 talk about it
https://youtu.be/sClk6aB_CPk https://youtu.be/sClk6aB_CPk
)
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.
- hbrn 4y agoI don't think you're arguing in good faith. > 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.