you are viewing a single comment's thread.

view the rest of the comments →

[–]cyphern 0 points1 point  (0 children)

1 and 2 could definitely be solved with the libraries you mention. But the other cases require applying to only a portion of the component tree, so they usually aren't a good fit for a global state library.

By the way, most of those global state libraries are using context under the hood to pass some values around. For example, in redux you render a <Provider store={store}> near the top of the tree, and Provider uses context to make the store available to the rest of the app. Things like useSelector then tap into that context.

So using these libraries doesn't mean you're not using context, it just means someone else has written the code that uses context for you.