Earlier quoted context omitted.
The caveat here is that with flux/redux, I'd argue "make as few components as reasonably possible interact with redux" is a best practice. If "things popping out of nowhere" is a problem, you probably have too many components listening on your stores.
That was actually the early advice for how to use Redux, but experience has shown that leads to less than optimal performance. In fact, benchmarks show that _more_ connected components usually leads to better perf, as the cost of notifying more subscribers is less than the cost of more wasted re-renders. See the following links for more info: - http://blog.isquaredsoftware.com/2017/01/practical-redux-par... - http://…
Redux-query – A React/Redux library for querying and managing network state
31–40 of 63 posts
Re: Redux-query – A React/Redux library for querying and managing network state
#32Earlier quoted context omitted.
The caveat here is that with flux/redux, I'd argue "make as few components as reasonably possible interact with redux" is a best practice. If "things popping out of nowhere" is a problem, you probably have too many components listening on your stores.
That was actually the early advice for how to use Redux, but experience has shown that leads to less than optimal performance. In fact, benchmarks show that _more_ connected components usually leads to better perf, as the cost of notifying more subscribers is less than the cost of more wasted re-renders. See the following links for more info: - http://blog.isquaredsoftware.com/2017/01/practical-redux-par... - http://…
Re: Redux-query – A React/Redux library for querying and managing network state
#33Earlier quoted context omitted.
The beauty of redux itself is the lack of magic. It's essentially just a design pattern and is trivial to follow. So the "edit" part of your comment is key here: frameworks built on top of redux, including middlewares, store enhancers and stuff can definitely lead to an app that is hard to reason about with side effects happening in places you don't expect. IMO that ends up being the worse of both world: even with al…
Redux is difficult to reason about because side-effects can be triggered from anywhere in the application by middleware. If you're using something like redux-thunk, a single dispatch can cause both a store mutation AND trigger a side effect, which is confusing. I'd rather have those be 2 separate concerns. Those dispatches can be triggered from anywhere in the app, and multiple middlewares may trigger multiple side-e…
Redux-loop had a nice model for side effects, but the syntax did not mesh well with javascript limitations. Redux-saga is nice for testing, but it adds new non-standard concepts on top of generators that make it complicated. I really like the Netflix solution (redux-observable).
Since JS is not Haskell, side effects can be shoved to the side a bit, but there aren't a whole lot of ways to make them nice.
CycleJS probably has one of the better systems. In Redux, even without redux-observables, if you closely follow redux semantics I find that reasoning around thunks works quite well (if you're making sure that your actions are semantic and not glorified setters)
Re: Redux-query – A React/Redux library for querying and managing network state
#34If anyone's interested, I maintain a list of Redux-related addons and utilities over at https://github.com/markerikson/redux-ecosystem-links . Includes just about every vaguely-useful-looking middleware, action-generation utility, devtool, store enhancer, fill-in-category-here, that I've seen out there. (And yes, I already had redux-query in the list before this post :) )
Re: Redux-query – A React/Redux library for querying and managing network state
#35If anyone's interested, I maintain a list of Redux-related addons and utilities over at https://github.com/markerikson/redux-ecosystem-links . Includes just about every vaguely-useful-looking middleware, action-generation utility, devtool, store enhancer, fill-in-category-here, that I've seen out there. (And yes, I already had redux-query in the list before this post :) )
Awesome resource! And thanks!
Re: Redux-query – A React/Redux library for querying and managing network state
#36Earlier quoted context omitted.
The caveat here is that with flux/redux, I'd argue "make as few components as reasonably possible interact with redux" is a best practice. If "things popping out of nowhere" is a problem, you probably have too many components listening on your stores.
That was actually the early advice for how to use Redux, but experience has shown that leads to less than optimal performance. In fact, benchmarks show that _more_ connected components usually leads to better perf, as the cost of notifying more subscribers is less than the cost of more wasted re-renders. See the following links for more info: - http://blog.isquaredsoftware.com/2017/01/practical-redux-par... - http://…
Re: Redux-query – A React/Redux library for querying and managing network state
#37No reason why you cannot combine both Redux + Relay, in fact once the app gets to a certain size and you want to rely less on passing around long chains of callbacks and state objects then you pretty much have to implement either Redux, Mobx or similar.
Re: Redux-query – A React/Redux library for querying and managing network state
#38I love react, with the reusable components and the ergonomic of jsx but I really don't like what redux does to your code: it involves too much magic, you lose the concept of independent components and every change becomes a global one: everybody is notified of the inner state of each component … To me it just break all encapsulation and just lead to massive tangled code that is really hard to maintain … Edit: I want…
Consider MobX, it's just getter-setter pairs for actual change detection. It's the declarative reactive one-way flow binder you want. It saved me a lot of time. People think redux is about functional immutable stuff. It's not functional and state is obviously not immutable (then nothing would happen). Redux is just about "what's the smallest thing we can do to get React to know when to render" and the answer is "put…
Edit: The first result for MobX in the French version of DDG is a porn site xD.
Re: Redux-query – A React/Redux library for querying and managing network state
#39I'm very surprised that Relay is not getting more traction in this space. Given, it's a lot of work to get it set up and running but once it's in place it's great. I haven't found a library that manages network state and the associated difficulties that come with it better. No reason why you cannot combine both Redux + Relay, in fact once the app gets to a certain size and you want to rely less on passing around long…
Re: Redux-query – A React/Redux library for querying and managing network state
#40How to solve a problem when same entities have different fields, for example: List of members of a chat should display avatar, name and username, but viewing profile usually use much much more data to display. How to merge them? How to keep fields in sync and not to download everything in all requests. For example, loading all members can be slow when fetching full user profiles and should be avoided.