6 ms·
In Javascript, closures both have identity and are mutable, which is a huge pain when using React.
by 7786655 6y ago
In Javascript, closures both have identity and are mutable, which is a huge pain when using React.
- Quekid5 6y agoI realize I was quite off-putting in my original reply, but "have identity" in what way, exactly? A memory address?
- Quekid5 6y agoJS... the "winner" of the Accidental Complexity game. (It was made in a couple of weeks, so it's excusable, but... it just hurts so much that this was the language that conquered the web :| )
- eitland 6y agoYes, and realizing there is probably a larhe subset of people who'd say they love JS but hate PHP can make a man who know both too well confused. Or at least aware of the hypocrisy ;-)
- jchw 6y agoTo be fair, PHP5 really was quite a nightmare for honestly a lot of reasons that JS was never. I think most people remember PHP5 and compare it to fairly modern JS, but I must say, modern PHP is a lot better than older PHP (i still prefer just about anything else.)
- eitland 6y agoTotally agree. But comparing modern Javascript to ancient PHP would be even more unreasonable.
- jchw 6y agoYes, to be clear, I agree. I think most people just don’t realize PHP actually did improve. I’ll admit until digging into a modern PHP library I didn’t even believe it could be meaningfully better.
- ss3000 6y agoI would say the biggest JavaScript inflicted pain when working with React is the lack of a notion of value equality in the default mutable collections. Coming from a ClojureScript background, it pains me to have to deal with all the idioms in React that hack around this fundamental impedance mismatch by forcing users to carefully maintain reference equality for collections between renders for perf optimizations, and more recently for correctness in hooks like useEffect.