THIS is the big league stuff I like to submerse myself in! I had to comb through about 200 thumbnails covering "advanced" topics with class component based state counters. Def not helpful when you're looking for real talk like this. awesome job Kent, looking forward to one of your courses/workshops in the future!
So, I understand making things too complicated with global state. And I've really struggle to keep my state scope minimized and properly isolated. However IMO the best part of separating state (I haven't used redux much, but NGRX (redux for angular) and BLoC (similar idea in Flutter)) is that all of the logic is separated, state can be inspected at discrete steps and verified in testing, and the UI can be tested separately to make sure that it displays a given state correctly. This is the biggest strength IMO.
This is great. It amazes me how people latched on to redux when it really isn’t necessary with modern react. When I hear redux the first thing that comes to mind is a black mass ceremony 😂
Rather than creating a global context or having a page-level context, should we have Context.Provider wherever necessary in page component or its children, as long as the context lives in the closest common parent? Is it ok to sprinkle Context.Provider all over the component tree wherever necessary to try to colocate state?
Why are we trying to cache our server data in javascript using complex state management libraries instead of just letting ETags and the built in cache control in the browser take care of this for us?
This composition thing seems like regenerating the same "global space" idea, just not in the state layer, but in the JSX layer. And prop drilling _is_ a problem, despite that it's not react specific, it still is a problem, it makes your components context sensitive. Prop drilling and JSX composition essentially carries the same kind of parameterization overhead issue. Any kind of overhead is a problem. It's much simpler to handle state orthogonally, in a separate, "global" layer.
I don't like to lift the state up. The reason for that I believe it's not a good encapsulation. And make the component to which the state really belong to, make that component not reuseable.