Questions tagged [redux-reducers]
195 questions
0
votes
0 answers
How to determine the last called action in NgRx?
Is it possible to determine the last called action in an Angular/Redux project in the code so that I can react on it in the observer? Currently I am using a property in my redux store which is set to the current name of the action in the…

richard
- 724
- 2
- 14
- 36
0
votes
1 answer
Possible to add a reducer that can read from multiple state slices?
I am using createSlice to create slices of state. Let's call them sliceA and sliceB. Mostly these slices are decoupled from each other. However I would like to create one reducer in sliceA that has (read) access to both sliceA and sliceB. Is this…

Museful
- 6,711
- 5
- 42
- 68
0
votes
0 answers
How to update a value with reducer via text input?
I would like to update the value of a variable in the reducer. In the app the user can type the username in a text input field in one screen. The reducer should update this state so that I can output it on a different screen. Right now I'm using…

CodingNoob28
- 23
- 1
- 6
0
votes
1 answer
How update a state in reducer from router parameters
On my website, my user can connect to two different types of accounts.
This is the authentification scenario.
Connection A:
User click on connection A link --> a form appears --> the state for the user update type property with 'roleA'.
Connection…

orphen92300
- 105
- 3
- 9
0
votes
0 answers
How to update value with reducer?
I would like to create a reducer that updates the value of a variable.
So far I have this but I don't know which code to use to update the value:
import { createSlice } from '@reduxjs/toolkit';
const initialStateValue = {
value: ''
…

CodingNoob28
- 23
- 1
- 6
0
votes
1 answer
Redux preloaded state is undefined with combineReducers
I am using Redux and I have the following piece of code:
const initialState = {
foo: "foo",
};
const store = createStore(
rootReducer,
initialState
);
...
const rootReducer = combineReducers({,
foo: (state) => {
console.log(state);
…

user2340612
- 10,053
- 4
- 41
- 66
0
votes
1 answer
Using reducer (combineReducers) in React Redux
I am trying to use combineReducers in React redux but i keep receiving this error in the console.
"reducer" is a required argument, and must be a function or an object
of functions that can be passed to combineReducers
the store.js
import {…

newprogrammer12
- 231
- 1
- 10
0
votes
1 answer
how to use redux thunk to fetch data
guys hope you all are doing great, Well I am using redux and I am not getting my result,
I would like to describe my issue step by step I hope it will bater for understanding
(1) POSTMAN RESULT
(i) get request , (ii) JSON data
Here is the code of…

Zaryab Khan
- 73
- 1
- 13
0
votes
1 answer
React-Redux: how to set the state?
I am trying to understand someone else their code but have difficulty understand the interaction between Redux and React.
On a React page, I invoke a Redux action called getSubscriptionPlan. Inside that Redux action, I see it is able to load the…

Marty
- 2,132
- 4
- 21
- 47
0
votes
1 answer
Is a forEach in redux reducer an anti-pattern?
I have a forEach loop which checks if a certain attribute of data coming in includes '/' if it does im replace the '/' with '-', i was wondering if that is valid redux code or im creating some sort of anti-pattern code right here.
case…

karterkortland
- 31
- 4
0
votes
1 answer
Redux Toolkit matcher to determine if exists in state
I have a large reducer where I'm storing all data entities in a flat structure.
I want to seperate this into 2 seperate reducers so that some of the entities are persisted with Redux Persist and some are not.
To acheive this, I'm trying to add a…

beek
- 3,522
- 8
- 33
- 86
0
votes
0 answers
Adding select all checkbox to material-ui table header stopped taking input on each cell - reactjs
First a heads up - This code is handed over to me and I have tried to simplify the problem to present here as much as I could..
Background
There is a 2d table that is getting column header from data array and row header from samples…

Samra
- 1,815
- 4
- 35
- 71
0
votes
1 answer
How to create reusable redux-module?
For example, my app contains the two list: colors & my favorite colors. How to create the re-usable filter-module for this two lists?
The problem is the actions in redux commiting into global scope, so filter-reducer for colors and filter-reducer…

Evgeniy
- 303
- 2
- 9
0
votes
2 answers
Can't change initialState in Redux slice
I created my themeSlice with hardCoded themes in mind initialState:{theme: "lightTheme"}. I quickly realized a better way to do it was by using a simple boolean value initialState: { darkTheme: false }.
After making the changes and running the…

Arcanus
- 642
- 5
- 20
0
votes
3 answers
Redux switch case error on reducer ts file
The code is compiled by webpack but I have an error on the browser console.
The problem seems to be at the line : 'switch (action.type)'
Here is the code :
./reducer
import { produce } from 'immer';
import ActionTypeKeys from…

etrix
- 59
- 6