Questions tagged [redux]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
26 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", ...
0
votes
1answer
33 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 ...
1
vote
0answers
11 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 ...
1
vote
0answers
48 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 ...
0
votes
0answers
29 views

Should redux store take care for fetching, updating and deleting data from an API?

I'm not very familiar with redux, but most of the resources about the topic recommends to place CRUD API calls in the redux store via middlewares and use additional states like: FETCH_SUCCEEDED, ...
1
vote
0answers
50 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 ...
2
votes
0answers
25 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 ...
0
votes
0answers
16 views

Storing partial data in a redux store, how should be this done?

In my app I have some data to be fetched from the server (a list of recipes). In certain views, only a preview of the recipe is shown--this includes fields like title, rating, and an image of the ...
0
votes
1answer
108 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 ...
0
votes
0answers
57 views

React CRUD patterns

My strategy with react forms has always been (psuedocode): CreateFoo - simply hooks up redux actions to save new record - onOk = (draft) => dispatch(addFoo(draft)); - return <FooForm onOk={...
3
votes
0answers
33 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 "...
1
vote
2answers
761 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 ...
0
votes
0answers
24 views

Confidentiality concerns in including all state+actions crash report

I am working on creating a method to send crash report details for an Office Add-In created with Redux. Because of the way Redux works, it is possible to get the entire application's state as well as ...
0
votes
0answers
114 views

Optimizing web dashboard with editable elements for performance by introducing ElasticSearch

To improve performance, we are optimizing our complex tabular web-based dashboard that loads a lot of data (many columns and rows). Many cells in the table are editable so the data is mutable. Our ...
0
votes
1answer
475 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]; ...
4
votes
0answers
327 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
78 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
75 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
700 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. ...
5
votes
1answer
5k 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. ...
3
votes
1answer
1k 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 ...
-1
votes
1answer
66 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
133 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
171 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 ...
3
votes
0answers
62 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
141 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 ...
1
vote
1answer
336 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: { ...
2
votes
1answer
95 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
5k 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
280 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
358 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
59 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: /...
3
votes
0answers
257 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
283 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
215 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
343 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
338 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
210 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
595 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
197 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
610 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
194 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
1k 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 ...
16
votes
3answers
2k 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
618 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
923 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
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, ...
5
votes
1answer
858 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 ...
25
votes
1answer
6k 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 ...