Twitter | Search | |
Dan Abramov 🌴 Nov 20
Good thread on the problems with Redux Thunk. Indeed “glorified setters” is a very common misuse of Redux.
Reply Retweet Like
Dan Abramov 🌴 Nov 20
Replying to @dan_abramov
If your actions creator names start with set* and you often call multiple in a row, you might be missing the point of using Redux.
Reply Retweet Like
Dan Abramov 🌴
The point is to decouple “what happened” from “how the state changes”. “Setter” action creators defeat the purpose, conflating the two.
Reply Retweet Like More
Dan Abramov 🌴 Nov 20
Replying to @dan_abramov
They are also inefficient and may lead to inconsistent UI. Dispatching multiple times is an escape hatch and should be used sparingly.
Reply Retweet Like
Dan Abramov 🌴 Nov 20
Replying to @dan_abramov
Why don’t we explain this in the docs? When we wrote them we did so for Flux users and assumed understanding of what Flux actions are.
Reply Retweet Like
David Blurton Nov 20
Replying to @dan_abramov
I think this has changed and many people use redux now without using other flux implementations first.
Reply Retweet Like
Pasi Hirvonen Nov 20
Replying to @dan_abramov
so is "double dispatch" bad if 2nd is usually router push? I.e. do x and navigate. Never run into problems so far.
Reply Retweet Like
Erik Rasmussen Nov 20
For sure. Most Redux users have probably never heard of Flux. How things change in 1.5 years....
Reply Retweet Like
Erik Rasmussen Nov 20
Replying to @pasihi @dan_abramov
Whilst libraries exist for batching actions, I often wonder if the Redux API shouldn't be dispatch(...actions)...
Reply Retweet Like
Dan Abramov 🌴 Nov 20
Replying to @davidblurton
I know but I don't have time to contribute to docs right now
Reply Retweet Like
Justin Falcone Nov 20
Replying to @pasihi
make a route reducer that maintains the URL and a middleware that keeps the location in sync with it
Reply Retweet Like
Dan Abramov 🌴 Nov 20
Replying to @pasihi
That's absolutely fine, not the pattern I was referring to (multiple "setters")
Reply Retweet Like
David Blurton Nov 20
Replying to @dan_abramov
if you open an issue for things that are missing, I'll have a go at writing something.
Reply Retweet Like
Rob Colburn Nov 20
other than animation, why batch actions?
Reply Retweet Like
Rob Colburn Nov 20
if you need to tell redux that multiple things happened, just make a new action
Reply Retweet Like
Erik Rasmussen Nov 20
For third party libs where you can’t just “make a new action”, for example…
Reply Retweet Like
Pasi Hirvonen Nov 20
Replying to @modernserf
there's that but oft. the simplest solution is the simple solution. And like said, never ran into problems. Tech or mainly. rel
Reply Retweet Like
Pasi Hirvonen Nov 20
Replying to @modernserf
maintenance related. I fail at twitter speak
Reply Retweet Like
Dean Nov 20
not seeing how this is bad: d (ac2), d (ac3), d (ac4) all in one actionCreator dispatching multi actions?
Reply Retweet Like
Mark Erikson Nov 20
Erm. Yeah, _totally_ had that discussion already :) See for the nitty-gritty details
Reply Retweet Like