News for hackers. Stuff that matters.
Re:Redux – Not Dead Yet (2018) by petilon on Thursday April 09, 2020 @10:36AM (#22822919)
Overrated. In what kind of application do you need this? In the vast majority of React apps you do not need this.
Re:Redux – Not Dead Yet (2018) by onion2k on Thursday April 09, 2020 @10:44AM (#22822996)
In the vast majority of React apps you do not need this.

I work on an app that has a total of about 400 separate Redux actions across half a dozen reducers and a couple of stores. There's a lot of things that cause side effects. Being about to see what actions fired with various props is immensely useful for debugging. redux-devtools and Reactotron are immensely useful. You're right that the majority of React apps don't need to trace actions, but when you do you definitely won't think it's overrated.

Re:Redux – Not Dead Yet (2018) by runawaybottle on Thursday April 09, 2020 @10:52AM (#22823098)
Can you give me an example how you got to 400 actions? Just enumerate like 5 or so, I’m assuming you are building features where groups of actions are just necessary based on the patterns you are using.

I’m genuinely curious because I feel like this kind of inflation of actions/reducers in Redux is what makes it nightmarish.

Re:Redux – Not Dead Yet (2018) by jfengel on Thursday April 09, 2020 @11:07AM (#22823243)
For one thing they do encourage a lot of tiny actions. A frequent pattern I use requires three actions for every server call: one to trigger a saga, one when it succeeds, and one for when it fails.

The standard form is incredibly verbose, I've started to shift away from it.

Re:Redux – Not Dead Yet (2018) by acemarke on Thursday April 09, 2020 @11:33AM (#22823521)
Note that the new `createAsyncThunk` API in Redux Toolkit handles generating and dispatching the promise lifecycle actions for you [0]. Also, while sagas are a great power tool, most Redux apps don't need them [1].

[0] https://redux-toolkit.js.org/api/createAsyncThunk

[1] https://blog.isquaredsoftware.com/2020/02/blogged-answers-wh...

Re:Redux – Not Dead Yet (2018) by mikewhy on Thursday April 09, 2020 @01:22PM (#22824903)
Awesome! It's great to finally have some links to share.

The company I'm currently working with is the first time I've used sagas / observables / "anything async is through side effects". I've constantly been saying "this is madness, this giant block of code, all these concepts, all this room for things to go wrong, just to do a `fetch`?". It's also the first time in a few years of using redux I've had to deal with race conditions.

Edit: Oh, and you can even `await dispatch`! All the things I've been doing in Redux for years and told I shouldn't, now being officially endorsed.

Re:Redux – Not Dead Yet (2018) by majewsky on Thursday April 09, 2020 @04:59PM (#22827130)
Here's a real-world example, from an OpenStack dashboard developed in my team that uses React/Redux for some of the newer parts (most parts are still server-side only): https://github.com/sapcc/elektra/blob/e4d93bc601caa99cceb7ba...

That's 76 actions just for the NFS/CIFS-as-a-service UI.

(I'm not saying this is the best way to do it, but that's what's happening right now.)

Re:Redux – Not Dead Yet (2018) by onion2k on Thursday April 09, 2020 @11:16AM (#22823332)
Can you give me an example how you got to 400 actions?

I'm not going to go in to detail on HN, but the app I work on is used to make diagrams for the legal industry and to define how they change over time. It's sort of like Visio for lawyers, with a basic animation editor that understands the underlying data. There are a lot of actions simply because it does a lot of things that can't be generalised in to higher level actions (well, they could, but it'd be messy.)

Re:Redux – Not Dead Yet (2018) by doomguyfromhell on Thursday April 09, 2020 @10:56PM (#22829547)
400 actions is actually not that much at all... I would even say, quite a small app.
Re:Redux – Not Dead Yet (2018) by heyoni on Thursday April 09, 2020 @11:14PM (#22829653)
Ugh, we get it. Only 1 billion rows, it’s not big data yet ;)
Re:Redux – Not Dead Yet (2018) by petilon on Thursday April 09, 2020 @10:48AM (#22823047)
> You're right that the majority of React apps don't need to trace actions, but when you do you definitely won't think it's overrated.

I think Redux is overrated because it is used by a lot of applications that don't need it.

Re:Redux – Not Dead Yet (2018) by dahart on Thursday April 09, 2020 @05:15PM (#22827287)
Have you used it? That’s like saying the Chrome debugger or CPU call stacks are overrated. It’s a debug feature that any React+Redux app can use to trace back why something happened. I’ve used it a few times, and when you need it because you don’t understand why an action was triggered, it’s super convenient.
Re:Redux – Not Dead Yet (2018) by mosdl on Thursday April 09, 2020 @08:45PM (#22828791)
You know what happened, not how. Was it a user click on this button or another button? Or was the action triggered by a saga?
Re:Redux – Not Dead Yet (2018) by sefrost on Thursday April 09, 2020 @10:43AM (#22822981)
I found it incredibly useful when debugging race conditions, usually caused by network requests.
Re:Redux – Not Dead Yet (2018) by batiste on Thursday April 09, 2020 @11:23AM (#22823418)
I concur. I used React for a year or so I never used this feature once. I was too busy writing all the necessary boilerplate.
Re:Redux – Not Dead Yet (2018) by ojr on Thursday April 09, 2020 @11:24AM (#22823434)
any application that you need to debug, I have not ran into a application React or not that I didn't need to debug and Redux does help with debugging greatly.