4 ms·
Overrated. In what kind of application do you need this? In the vast majority of React apps you do not need this.
by petilon 7y ago
Overrated. In what kind of application do you need this? In the vast majority of React apps you do not need this.
- sefrost 7y agoI found it incredibly useful when debugging race conditions, usually caused by network requests.
- onion2k 7y agoIn 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.
- petilon 7y ago> 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.
- runawaybottle 7y agoCan 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.
- jfengel 7y agoFor 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.
- acemarke 7y agoNote 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 https://redux-toolkit.js.org/api/createAsyncThunk [1] https://blog.isquaredsoftware.com/2020/02/blogged-answers-why-redux-toolkit-uses-thunks-for-async-logic/ https://blog.isquaredsoftware.com/2020/02/blogged-answers-wh...
- mikewhy 7y agoAwesome! 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.
- onion2k 7y agoCan 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.)
- majewsky 7y agoHere'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/e4d93bc601caa99cceb7ba66221bcf102529f2e9/plugins/shared_filesystem_storage/app/javascript/app/constants.js#L1-L99 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.)
- doomguyfromhell 7y ago400 actions is actually not that much at all... I would even say, quite a small app.
- heyoni 7y agoUgh, we get it. Only 1 billion rows, it’s not big data yet ;)
- batiste 7y agoI concur. I used React for a year or so I never used this feature once. I was too busy writing all the necessary boilerplate.
- ojr 7y agoany 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.
- dahart 7y agoHave 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.
- mosdl 7y agoYou know what happened, not how. Was it a user click on this button or another button? Or was the action triggered by a saga?