Redux is a predictable state container for JavaScript applications based on the Flux design pattern.
Questions tagged [redux]
52 questions
50
votes
3 answers
Are front-end state management tools an anti-pattern?
I'm currently reading "Code Complete" by Steve McConnell. In section 13.3 "Global data" in last paragraph "Don’t pretend you’re not using global data by putting all your data into a monster object and passing it everywhere", he said:
Putting…

CoderDesu
- 1,005
- 5
- 10
31
votes
1 answer
Is there a good formal pattern to manage state in MVVM?
I have started learning about Redux and React in the web-world, and the more I learn about it the more I'm realizing how painful state management is in the desktop-world with WPF's MVVM-style architecture (using Caliburn specifically to bind Views…

willem
- 1,053
- 9
- 10
17
votes
3 answers
Is Redux using a sanitized God object pattern?
While learning about Redux, the God-object pattern(or anti-pattern) came to my mind- both have a single big object holding all the app data and methods to manipulate them. But Redux has put some constraints like making the Object immutable and…

Gulshan
- 9,402
- 10
- 58
- 89
9
votes
1 answer
Does it make sense to apply the principles in Redux to OO languages?
Redux is essentially functional programming, and it makes a lot of sense. As I move back to a non-javascript OOP language in a different project I would like to apply the same principles such as single state object, reducers which act on parts of…

tt9
- 611
- 7
- 19
5
votes
1 answer
Redux LOADING/SUCCESS/ERROR pattern - when using redux-saga
On a typical web app, we commonly have to deal the LOADING/SUCCESS/ERROR problem - which is that:
When I make a backend request I want to display a loading cursor, perhaps disable some buttons.
When the request finishes successfully, I want to…

dwjohnston
- 2,543
- 6
- 29
- 49
5
votes
1 answer
Creating generic actions in redux
I am wondering if there is anything wrong with creating generic actions in redux which dynamically change different properties in the store , so that i can reduce boilerplate code.
For example:
//GenericActions.js
function replace(data, property)…

Mr. MonoChrome
- 195
- 1
- 4
4
votes
0 answers
Decoupling redux reducer tests from state shape
Recently I have been refactoring state shape in a fairly large redux application, and I have found that one of the obstacles to doing to is that the tests for my reducers clearly have a lot of "knowledge" about the "shape" of the state tree.
There…

samfrances
- 1,065
- 1
- 10
- 15
4
votes
0 answers
How should a non-React component subscribe and respond to Redux state changes?
I’m new to React/Redux tools and still figuring out some idiomatic design patterns.
Here's a scenario:
A user adding a place marker (that has some associated metadata) to an interactive map (Leaflet), which should be held in state.
I’ve just come…

danwild
- 149
- 3
4
votes
1 answer
React: Redux vs Singleton service
An application I'm currently working on in our front end we currently use React, Redux and some singleton services (wrappers around some 3rd party libraries). We started discussing a new feature which we need to develop which involves non-changing…

Elliot Smith
- 59
- 1
- 5
4
votes
3 answers
How do I manage dependant values without running the same computation twice?
I am working on an application that is essentially a calculator, not the handheld calculator but more of a spreadsheet. It will take many inputs across different views and show the outputs all over the place.
The application will be running many…

Matias Faure
- 149
- 4
3
votes
0 answers
How does "redux" decouple the different components so they can be tested separately in unit tests?
In the past we saw a big move from traditional MVC to MVVM for user interfaces:
One of the primary motivations for MVVM is that the view and viemmodel are competely indepedently of each other and can work/stay alive without each other. Since the…

paul23
- 1,061
- 1
- 8
- 14
3
votes
0 answers
Redux Saga pattern for large, non-specific server responses
Our current Redux state tree is this:
{
"dog": {
"name": "Barkley",
"age": 6,
"hungry": false,
"location": "Living Room",
"height": "36 in."
},
"cat": {
"name": "Sir Eatsalot",
…

Matt
- 293
- 3
- 10
3
votes
1 answer
What is a (Redux) selector?
I am learning Redux (a JavaScript state container tool). I am finding numerous references to something called a "selector" (e.g. here, here, here, and here). However, I don't seem to be finding a simple definition of what a selector is (as opposed…

Andrew Willems
- 589
- 2
- 11
3
votes
1 answer
Do we need redux here?
In an ongoing project my team is building a new web application that relies heavily on a rest api. As we decided to try react we naturally came to implement redux and a middleware, as we've read this is the way to go. However, further into the…

Marco Kerwitz
- 133
- 3
2
votes
1 answer
Are ViewModels within an NgRX store an anti-pattern?
I have a complex Angular app which has a large number of UI components. I have a central NgRX store. I have a 'pure' data model in the store which gets updated via the backend and via user input. Whenever the central store is updated I build several…

Journeyman
- 337
- 3
- 7