Questions tagged [redux-reducers]
195 questions
0
votes
1 answer
Actions takes in info but reducer doesn't do anything?
I am trying to POST an instance of a user resource to my project. I noticed the state wasn't updating when I had to wait until I restarted my project to see the new instance. In my project there is a many to many relationship between users and…

st123
- 246
- 3
- 14
0
votes
1 answer
Custom Redux undo reducer state variables not recognized
In order to implement a custom undo/redo function I followed the instructions in https://redux.js.org/recipes/implementing-undo-history and modified them to fit into my own reducer. Now when I attempt to run the code I get the errors that past,…

Geoff
- 353
- 3
- 19
0
votes
1 answer
How to run migrations on multiple reducers in redux-persist store?
I have working redux-persist code for one reducer in redux-persist store. I give initial state of reducer to store and after every change in state structure of reducer I update the migration number (which is 25 in this example) and it works fine.…

Farwa Ali
- 11
- 3
0
votes
0 answers
state variable are updating eachother in react redux?
I am having trouble with react redux. In one of my reducer whose function is to add to cart.
I get the selected item as an object from array(e.g recentProducts). In array i change quantity unfortunately quantity also auto changes in the selected…

Abdulmoiz Ahmer
- 1,953
- 17
- 39
0
votes
2 answers
In redux reducers when updating, should it not be state.slice().map instead of state.map()?
So I was going through the redux documentation on Reducers topic, and they had mentioned it should be pure functions. I understand this is for comparing whether the state object is the same or old. But I noticed the following code snippet at Redux…

Niragh
- 162
- 2
- 10
0
votes
1 answer
How to update redux store tree and then update another tree with data from first?
I have a chart and ui with data inputs for it. I use redux to store data for chart. I have 2 trees. One - for chart component. It contains array of numbers (axis coordinates). And second for ui. It contains array of objects: {axis coordinate,…

Kirill Morozov
- 89
- 6
0
votes
2 answers
How to update certain key values in an object nested in the redux state
I have the following data :
Project : {id:10,
requirements: [{id:1,
title:test},
{id:2,
title:test2}]
}
and
action.payload : {id:1,
…

neowenshun
- 860
- 1
- 7
- 21
0
votes
1 answer
Updating a value in an object in Redux reducer
I am looking to update value(s) in a nested object based on user input. So for instance, if the user chooses to update their country and street, only those values will be passed as the action.payload to the reducer and updated (the rest of the state…

critical_maas
- 127
- 1
- 3
- 9
0
votes
1 answer
How to change initState in rootReducer in Redux
I am new in Redux and I am wondering if it's possible to change one state depending on another state inside initState?
const initState = {
expenses:[
{ key: '1', sum: '100'},
{ key: '2', sum: '200'},
{ key: '3', sum:…

Vova
- 750
- 11
- 26
0
votes
0 answers
How Can I filter an array of objects from reducer inicialstate in another component?
Well, I create a project with react and redux. In the reducer inicialstate I have an array of objects. I distribute the items on screen using map, ok.
But my main doubt is that I create a filter compoment with an input, but I dont know how can I…

Caroline
- 21
- 3
0
votes
1 answer
Unable to logout a user without putting a 'case LOGOUT' in all reducers
I am new to redux and trying to create a small site in which users can: login, register and logout.
I have created 2 reducers for login and registration and I have a "isLoggedIn" field initialized in both reducers' state.
When trying to create a…

Wicked528
- 1
- 1
- 1
0
votes
2 answers
trying to remove all items and add incoming items from a nested redux object
I have below reducer and below initial State. classinfo is the parent state which has a nested state array of students. with the below reducer I am planning (replace previous students with new students ) to delete all students from the previous…

dev0864
- 465
- 2
- 7
- 17
0
votes
1 answer
Calling a redux action inside another action is not working
i have console log the error and the error is visible in console but the setAlert action is not dispatching , why is that ?
This is the Auth action code
import axios from "axios"
import {setAlert} from "../actions/alert";
import { REGISTER_FAIL }…

Abdul Kàbéèr
- 237
- 1
- 11
0
votes
1 answer
Redux adding an object to an array not working for the first record only
When adding an object to an array with Redux, for some reason adding the first record would not work.
I would get the following error:
TypeError: Invalid attempt to spread non-iterable instance. in order to be iterable, non-array objects must have a…

hugger
- 426
- 4
- 19
0
votes
1 answer
Will using selectors to compute derived data from an API call perform better than doing within the reducer? (for this use-case)
Say I have a music store app where the user searches for guitars. On initial page load, I fetch a few varieties of guitars to display: (acoustic, electric, and bass). Pages of guitar results are returned together from a single API call but will…

Anthony O
- 622
- 7
- 26