Live data from Hacker News

Redux-query – A React/Redux library for querying and managing network state

amplitude.engineering

1–10 of 63 posts

Re: Redux-query – A React/Redux library for querying and managing network state

#2
I 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 to clarify what I mean with the «too much magic» part. It's not redux itself which has too much magic in it, just your application flow that becomes magic when using redux, especially with libraries like the one showed by this article or redux-form[1].

[1]: http://redux-form.com/

Re: Redux-query – A React/Redux library for querying and managing network state

#3
Heh, I made the same thing but with global endpoints and swappable drivers so that components can be shared and endpoints can be stubbed/mocked: https://gitHub.com/tonyhb/tectonic

Think that genraally we're learning that these things should be automated for us: loading data traditionally sucks. GraphQL is really where it's at!

edit: that mobile keyboard though...

Re: Redux-query – A React/Redux library for querying and managing network state

#4
post #2

I 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…

"Too much magic" is a serious stretch. Running through the tutorial here: https://egghead.io/courses/getting-started-with-redux, you pretty much reimplement the whole thing. It's just not that much code. There's plenty of optimizations and edge-case handling in the production version, but overall there just isn't much.

> you lose the concept of independent components

How? Components take props. They're just as independent as they were previously.

> everybody is notified of the inner state of each component

This... isn't the case.

Redux (and Flux in general) is useful when there is application-level data that needs to be shared across different components, and otherwise something ends up being a prop to a bunch of things that shouldn't be. Or when you want something to remain around when components go out of scope. If you don't have this problem, Redux is overkill. For larger apps, it's damn useful.

Re: Redux-query – A React/Redux library for querying and managing network state

#5
post #2

I 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…

Depends on how you use it. I just keep my application state in redux.

Redux itself has absolutely no magic. The only "magic" I see is when you add state diffing and memoization (reselect). And even in this case, it's not really hard to understand what's happening.

React with redux is just a big pubsub system, how you set up your application state and how each component interacts with that state will decide how "tangled" and hard to maintain your code is.

Re: Redux-query – A React/Redux library for querying and managing network state

#6
post #3

Heh, I made the same thing but with global endpoints and swappable drivers so that components can be shared and endpoints can be stubbed/mocked: https://gitHub.com/tonyhb/tectonic Think that genraally we're learning that these things should be automated for us: loading data traditionally sucks. GraphQL is really where it's at! edit: that mobile keyboard though...

Yeah, Apollo Client helps you do a lot of these kinds of things with GraphQL - deduplicating requests, keeping track of loading states, etc: dev.apollodata.com (disclaimer: I work on Apollo)

Re: Redux-query – A React/Redux library for querying and managing network state

#7
post #2

I 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…

I really don't think this is true. Redux is simple, and by using the react bindings, you get perfect encapsulation: components take props which can be from the state (so your component needs no knowledge of the state store) or action creators (which makes for easy test mocking). If anything, this makes your components a lot easier to read and reason about (and test).

Re: Redux-query – A React/Redux library for querying and managing network state

#9
post #3

Heh, I made the same thing but with global endpoints and swappable drivers so that components can be shared and endpoints can be stubbed/mocked: https://gitHub.com/tonyhb/tectonic Think that genraally we're learning that these things should be automated for us: loading data traditionally sucks. GraphQL is really where it's at! edit: that mobile keyboard though...

Author here. I totally agree if you're starting a new project or have the bandwidth to migrate to GraphQL – definitely consider it! However, I still think we'll need solutions that work for apps that use non-GraphQL APIs.

Re: Redux-query – A React/Redux library for querying and managing network state

#10
post #2

I 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…

Redux uses Event Sourcing. ES's trade-offs apply.
Post reply on HN