top | item 40195772

(no title)

deliriumchn | 1 year ago

Never understood this posts. React as a whole and state management became many times easier over the years (been working with it, vue and a bit of angular for 6+ years now).

Function components removed stuff like getDerivedStateFromProps and many other things, introduced clear and simple way of component updating (as in "prop reference changed, I'm gonna render now").

For state we got redux toolkit, which simplified reducers, zustand and recoil/jotai and mobx which allow you to pick based on your needs instead of writing million reducers or passing state to children when you don't really need it.

Its not "react got hard", its people unable to adapt to changing world. Every mainstream framework in reality got streamlined, simpler and more effecient to create apps.

discuss

order

Zambyte|1 year ago

> React as a whole and state management became many times easier over the years

This to me is exactly the problem actually. React was an object oriented framework; it leaned into that for managing state for components. Then they introduced stateful functional components in 16.8, and React became an entirely new paradigm. 16.8 should have been an entirely new framework, and yet it was merely a minor version bump. I can't find myself blaming users for finding it difficult to keep up with the whims of Facebook.

jfengel|1 year ago

I rather like React, but its names for things (like "getDerivedStateFromProps") are always just godawful. They're wordy, and even all of those words really don't make the purpose clear.

I was always particularly aggrieved by "mapStateToProps", which obfuscates that it's referring to the Redux state rather than the thing that's actually called "state" in the component. And why the heck are we mapping it into the props? (Not that "useSelector" is any great model of clarity, but at least it's a compact verb-noun pair.)