Questions tagged [redux]

The tag has no usage guidance.

0
votes
1answer
99 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]; ...
2
votes
0answers
200 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 (...
0
votes
1answer
36 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 ...
0
votes
2answers
73 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 ...
1
vote
2answers
248 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. ...
1
vote
1answer
1k 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. ...
1
vote
0answers
401 views

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 ...
-1
votes
1answer
64 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 = ...
0
votes
2answers
72 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 ...
0
votes
0answers
97 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 ...
2
votes
0answers
51 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 ...
1
vote
1answer
88 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 ...
0
votes
1answer
246 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: { ...
1
vote
1answer
67 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 ...
0
votes
1answer
3k 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 ...
0
votes
1answer
230 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 ...
1
vote
1answer
323 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 ...
-2
votes
1answer
57 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: /...
2
votes
0answers
220 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." }, "...
2
votes
1answer
223 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 ...
0
votes
1answer
170 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 ...
-2
votes
1answer
264 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 ...
1
vote
2answers
299 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 ...
0
votes
1answer
204 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 ...
3
votes
1answer
575 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 ...
2
votes
1answer
187 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'...
0
votes
1answer
538 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 ...
4
votes
3answers
183 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 ...
1
vote
1answer
886 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 ...
14
votes
3answers
1k 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 ...
0
votes
0answers
586 views

How to design the state tree using redux?

In the last days I have searched for a documenation on how and when is it best to use redux and how to design the state tree. My research ended in the conclution that there is no one currect answer. ...
3
votes
1answer
891 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 ...
1
vote
2answers
838 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, ...
5
votes
1answer
753 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: //...
9
votes
1answer
2k views

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 ...
18
votes
1answer
4k views

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 ...
2
votes
1answer
468 views

Should all the rendered data be stored in redux store?

Assume your app doesn't need to work offline. Also assume that you want to render some fresh data from server -> Redux store for that data is invalidated every time it's rendered. Does it make sense ...