35 points · by velmu · 8y ago · 45 comments
Redux is a state management layer. Future fetching does nothing to solve app-level state management.
Gross misrepresentation of Dan's talk by this article and he made zero mention of the React context API in the talk.
What about apollo-link-state? Not a replacement either per se, but seems like its one step closer to isomorphic (client & server side) state.
On one hand it normalizes your data & avoids thousands of lines of boilerplate, on the other hand you lose [some] control of the underlying data structures which is where you'd still need something like redux.
Seriously?
A CS degree is not necessary in order to understand functional programming, and it's not like reducer functions are all that complicated.
redux is useful for a lot more than just async fetching & loading. I think these new features will just reduce the scope of what redux is used heavily for.
Redux deliberately doesn't deal with async processes, that's left up to the user.
However - after having plugged in a lot of reducers - the boilerplate code required to do simple stuff becomes a real bore. I've since compromised by using a simple `key-value store` reducer that I can write new values to without needing a new reducer with accompanying actions.
I'm sure this is not how it's supposed to be used but nobody ain't got no time for making all that boilerplate just for a button :-)
Like I say - it's worth it though - it's amazing how large frontend apps "just work" once you have the state in a single place and the UI rendering from it and it alone.
interface FooState {
myNumber: number;
myArray: number[]
}
class Foo extends DataModelImpl<FooState> implements
IDataModel<FooState> {...}
Then you use it like so: const foo:IDataModel<FooState> = new Foo()
foo.updateState(state => state.myNumber = 10)
Anything that wants to be notified when myNumber changes: const callback = (num:number) => {...}
const unsubscribe = foo.watch(state => state.myNumber,callback);
...
unsubscribe()
I've bound this to React, Vue and other view libraries. It even works properly with nested objects.Drawback is that it uses Observers. I believe the next "killer state library" will use a pattern like what I've described above.
Huh?
Rather than what?
In fact another article linked ends pretty abruptly too.
ASP.NET, Spring and JEE work just fine.
https://dev-blog.apollodata.com/the-future-of-state-manageme...
Half the time is spent on novel new ways of adding in a loading spinner. Perhaps it's just his demo, but I can sense Roy Fielding shedding a tear.