Skip to main content

Questions tagged [redux]

Redux is a predictable state container for JavaScript applications based on the Flux design pattern.

Filter by
Sorted by
Tagged with
0 votes
0 answers
52 views

Best Practices for Managing State in React Applications

I'm currently developing a web application using React and I'm looking for the best practices for managing state effectively. I've come across several methods such as using the Context API, Redux, and ...
Tarun Rathore's user avatar
0 votes
1 answer
111 views

when would I need state management like redux in my e commerce app?

I am new to React and web development generally so please try to understand if the question seems dumb. So, I am currently making a simple e-commerce app and I was thinking of using state management ...
Solruhama's user avatar
0 votes
1 answer
135 views

How to actually use global state in React?

In my company, all of the projects use at least some kind of global state library like Redux and MobX. However, the actual usage is limited to storing fetched data, and it lacks any caching logic or ...
Erick Christian's user avatar
1 vote
0 answers
135 views

Where should I persist the side effects of actions?

I have a outlining app that I am writing using unidirectional dataflow and some of the concepts from Redux. When the user has selects items in the outline, and clicks indent, an indent action is fired....
bnieland's user avatar
51 votes
3 answers
7k views

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 ...
CoderDesu's user avatar
  • 1,015
0 votes
0 answers
310 views

Best route for multiple user roles with toggleable permissions with React and Django Rest Framework

What is the best way to create dynamic user roles that can have toggleable permissions? I am currently creating my very first website which has a react front end with redux toolkit and redux saga and ...
Asif333's user avatar
2 votes
1 answer
1k views

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. ...
Journeyman's user avatar
0 votes
1 answer
72 views

Organizing Data with Specific Group in Objects and Lists

So recently I have been working with a large-scale app that has a large number of individual objects with specific group attributes. For example, I have a list with objects such as {Name: "Todd", ...
Erol's user avatar
  • 23
0 votes
1 answer
51 views

In Redux is it better for performance to add a property to the items in the store or to calculate it in the container?

I'm writing my first Redux app. In my store, I have ~300-500 Island objects that I retriev from an API and index by an id string in an object (being treated like a map). When I'm editing one of ...
dx_over_dt's user avatar
1 vote
0 answers
14 views

Best way to allow other components to change table's focused row?

I have displayProjectTable that gets state from reducer projectData and populates itself. Currently displayProjectTable has a local state that stores focusedRowID. My problem is that I want other ...
Wyatt's user avatar
  • 111
2 votes
2 answers
507 views

How could I reuse common JS modules between several projects?

At my company, we are developing pretty simple React Native and sometimes mobile-only React apps. Most of them have some similar logic, such as 'sign-in by phone' flow, some payments stuff, etc., and ...
kuzkokov's user avatar
1 vote
0 answers
137 views

Where to place code which synchronizes state of Redux with localStorage?

In our project, I was need to sync a piece of information between localStorage and the Redux state. Actually I subscribed to changes in a localStorage and in Redux, and if change happens in ...
Anatoly's user avatar
  • 264
2 votes
0 answers
44 views

How authorize web application and manage sessions

i am building a single page react app that uses redux as state manager and an express node js as backend server but i don't know what is the best way to authorize my users in the application! if it ...
amin msh's user avatar
  • 129
1 vote
1 answer
411 views

What do you call the state reducer pattern used by redux?

Redux uses a state reducer pattern where essentially you create a pure function that looks like: function reducer (previousState, action) { //... return newState; } This looks similar to ...
dwjohnston's user avatar
  • 2,563
5 votes
0 answers
57 views

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 "...
samfrances's user avatar
  • 1,085
1 vote
2 answers
2k views

How to effectively handle 404/500 http errors in server-side rendering web application which uses store for state?

I'm working on a website using server-side rendering approach. I'm using React and Redux for this. Redux handles the state of the application and provides API to change the state. All asynchronous ...
Yos's user avatar
  • 157
0 votes
1 answer
995 views

"Fetch the data if it doesn't exist" selector?

Let's say I have a react component like this: const MyComponent = ({data}) => (<div>{JSON.stringify(data)}</div>); const myReduxSelector = (state, id) => state.someData[id]; ...
dwjohnston's user avatar
  • 2,563
4 votes
0 answers
545 views

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 (...
danwild's user avatar
  • 149
0 votes
1 answer
181 views

Correctly store device info with Redux in React Native app

I'm currently building a React Native application and wondering if storing device information such: if my app has granted location permission location service is turned on last known user location ...
lellefood's user avatar
  • 119
0 votes
2 answers
128 views

Should / When to create javascript object to serialize data?

I'm working on a React/Redux application. I receive a data object from the api resembling this: const dataObj = [ { id: 1, name: "Filo", activity: 9, info: { statusCode: 4 ...
mtmoran's user avatar
  • 103
1 vote
2 answers
1k views

When using Redux/Redux-Saga - should JWTs be set in the action creators/sagas?

Almost every blog post I've encountered around generic auth handling using JWTs in a React/Redux/Saga application does the same thing, which is to store the JWT in local storage, in the action/saga. ...
dwjohnston's user avatar
  • 2,563
5 votes
1 answer
7k views

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. ...
dwjohnston's user avatar
  • 2,563
4 votes
1 answer
3k views

React: Redux vs Singleton service [closed]

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 ...
Elliot Smith's user avatar
-1 votes
1 answer
92 views

My action creators and reducers all mostly look the same - is this a code smell?

Most of my redux actions are 'fetch some data from the database, here's the authentication token', and they for the most part look the same, like this: action creator export const fetchDashboard = ...
dwjohnston's user avatar
  • 2,563
0 votes
2 answers
187 views

React and redux app-wide translation best practices

My team and I want to translate an entire React-redux app into another language (english to arabic) and have a switch that does the app-wide translation via a redux action. The content for the first ...
Thomas Martres's user avatar
0 votes
0 answers
203 views

Is giving sub reducers access to the full state a bad idea?

I've got a Redux app with a fairly flat state tree. All sub reducers handle one separate part of the state, and they are tied together with combineReducers. My problem is that in a few cases I need ...
Anders's user avatar
  • 1,361
3 votes
0 answers
72 views

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 ...
paul23's user avatar
  • 1,091
1 vote
1 answer
209 views

OrderedMap or List for Redux structure?

I'm implementing a Redux store for a React app using redux-saga for API calls. I've used Immutable.js before for other Redux-using React apps but the nature of previous projects always evidently ...
timbo's user avatar
  • 159
1 vote
1 answer
489 views

Organizing reducers in Redux

I will use the following popular todo list example for demonstration. Let's say I wanted to create a very basic todo list with this structure as the app state: { todos: { todoKey1: { ...
Derek 朕會功夫's user avatar
2 votes
1 answer
123 views

Does Flux/Redux concept about application state put bounds on the size of application?

In Redux (React Flux implementation) guide https://redux.js.org/basics/reducers it is said, that In Redux, all the application state is stored as a single object My questions are: How seriously ...
TomR's user avatar
  • 1,003
0 votes
1 answer
8k views

Best Practice for handling data sync with React Native, MobX and REST?

We're developing an app using React Native and MobX for the state stores, and also using a Web API REST service for the GETs and POSTs. All is going well, so far we're able to use FETCH to get the ...
API's user avatar
  • 13
0 votes
1 answer
335 views

how to design redux actions involving chained side effects?

I am designing redux actions for a user signup. Signup process requires three entities to be created User, UserProfile and an Offer and involves side effects to handle async server calls. I wonder ...
ciekawy's user avatar
  • 109
1 vote
1 answer
409 views

How should I structure React Redux components when requesting Data From an API?

I have a search box I'm going to use on different pages (I use the term 'page' loosely here). The search box puts its value (the search string) into the Redux state. The results are populated from an ...
Stu Pegg's user avatar
  • 568
-2 votes
1 answer
65 views

Single Page Apps: handling state dependencies

If I have an React/Redux single page application that has - say - a customers page that lists businesses that are customers, and from there each customer can be accessed with a URL like this: /...
Rob Grant's user avatar
3 votes
0 answers
317 views

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." }, "...
Matt's user avatar
  • 293
2 votes
1 answer
371 views

react-redux (React bindings) vs Virtual Dom and Single responsibility principle

I understand React and Redux (at least think that I do). But the combination using the react-redux Binding package is a bit confusing to me. https://github.com/reactjs/react-redux The first thing ...
Natan Rubinstein's user avatar
0 votes
1 answer
290 views

Redux: When Should I Keep Track of State and When Should I Not?

NOTE: I am new with the whole concept of state management. I never got into the older languages that "explicitly used" states. I dived into React and Redux for the past week, and as I'm getting into ...
Ygam's user avatar
  • 485
-2 votes
1 answer
435 views

HTML5/Canvas Graphics editor and Immutable state (EaselJS and Redux, ngrx/store)

This question is about the architecture approach. How would someone go about creating the immutable state for a graphics editor that would eventually provide an "undo/redo" functionality, considering ...
flackjap's user avatar
1 vote
2 answers
376 views

React / GraphQL / Redux design question: Looking for a good practice

A React website I am building is going to have these sections: Hero, Projects, Courses, Skills and a few others. The Skill section will iterate though a list of skills and display a React component ...
Michael Bruce's user avatar
0 votes
1 answer
239 views

Does Angular2 or Angular4 offer an app state and middleware promise like React / Redux?

I used Angular 1 and React / Redux, and one thing I like about React / Redux is that there is a definite app state, and a middleware that can convert a promise into real data. In Angular 1, we often ...
nonopolarity's user avatar
  • 1,827
3 votes
1 answer
619 views

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 ...
Andrew Willems's user avatar
2 votes
1 answer
232 views

Does AngularJS or Angular 2 provide something similar to the Redux middleware so that AJAX data appear immediately available?

I am learning React / Redux, and one feature I like is, when you fire off an Action, you actually provide a request as the "result" or what is called the payload in Redux, and the Redux middleware won'...
nonopolarity's user avatar
  • 1,827
0 votes
1 answer
700 views

Functional model vs data model and react/redux

I have a module object, that consists of several parameters and an algorithm. A parameter consists of a min, max, step, label and value. The module's algorithm is regularly making a calculation ...
dwjohnston's user avatar
  • 2,563
4 votes
3 answers
223 views

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 ...
Matias Faure's user avatar
1 vote
1 answer
2k views

How to avoid get/set actions in redux?

The point of redux is to decouple "what happened" from "how the state changes" according to Dan, anyway, but I'm having trouble figuring out how to handle side effects without having getters and ...
drewwyatt's user avatar
  • 297
17 votes
3 answers
3k views

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 ...
Gulshan's user avatar
  • 9,462
1 vote
0 answers
642 views

How to design the state tree using redux?

In the last days I have searched for a documentation on how and when is it best to use redux and how to design the state tree. My research ended in the conclusion that there is no one correct answer. ...
Stav Alfi's user avatar
  • 297
3 votes
1 answer
973 views

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 ...
Marco Kerwitz's user avatar
1 vote
2 answers
1k views

How to structure a REST API response for a Flux/Redux frontend?

I have a question about how to structure a response where I return objects related to other objects (one-to-many/many-to-one), and to tell me if the way I've structured my endpoints are wrong or not, ...
Oscar Balladares's user avatar
5 votes
1 answer
964 views

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: //...
Mr. MonoChrome's user avatar