Questions tagged [redux-reducers]

195 questions
0
votes
2 answers

react shoping cart mutation issue

I'm practicing React, developing a Store, for adding the feature of the Shopping Cart I use this example. But in my implementation, even though my version is almost the same, the "add to cart" button doesn't differentiate between each product,…
Ivan Rubio
  • 15
  • 8
0
votes
2 answers

Action function always returning same reducer type in React after calling backend

So I'm in the last step to finish my 2FA methods, right now in the one in which I need to detect wether a user has enabled his or not and to achieve that, I created a funtion which returns the following: if (!user.twoFactorTokenEnabled) { // If…
Kirasiris
  • 523
  • 10
  • 37
0
votes
1 answer

What's wrong in my react redux application ,as it's not rendering things as expected?

I started using redux and just to test things out i started using combineReducers for more structured approach of designing things out ,but it doesn't work the same as everyone suggested.I have been scratching my head out that what's wrong in my…
0
votes
0 answers

Cannot read property from reducer in redux store

I'm trying to use redux in a react application. I've set up redux and configured store and provided the store to Provider that wraps the whole application. I cannot access any property from the store. My Index.js is as below import React from…
Shamim Fahad
  • 132
  • 2
  • 12
0
votes
2 answers

useReducer: Not able to get the initial state using userReducer

I have implemented useReducer to dispatch the action based on the action type and each time I'm updating a state variable based on the action type but always I'm getting an error while trying to read the initial state. Probably my code can explain…
0
votes
1 answer

Redux state show as Map, unable to access combineReducers properties

In mapStateToProps it's supposed to be as easy as accessing the key for the section of state you want, and get the state parameter but I am unable to do so. main app.js file import React from 'react' import ReactDom from 'react-dom' import {…
0
votes
2 answers

Set data in React hooks?

This is my code. const initialNoticeState = { id: props, title : '', description : '', image : '', updated_by : user.firstName+' '+user.lastName, priority : '' }; const [currentNotice, setCurrentNotice] =…
0
votes
1 answer

Can ActionCreators and Actions be mixed with Redux?

My experience is mostly with React Hooks & Context, where Actions & Reducers are defined. The Actions are then imported into a React component and called via a Dispatch function. On a new project, I must use React Hooks & Redux. Here I'm using…
robertwerner_sf
  • 1,091
  • 4
  • 21
  • 35
0
votes
1 answer

In Typescripted Redux, how do I find my root reducer's type?

export const makeStore = () => { const store = configureStore({ reducer: { reducer, growthReportSlice, selectBarSlice, }, .... return store; }; const dummy = makeStore(); export const wrapper =…
kmm3
  • 391
  • 3
  • 14
0
votes
2 answers

React Native: Redux - Is it possible to dispatch to redux store from App.js?

I am working on a react native app and I have everything hooked up to a redux store so that I can manage data in that way. I am curious about the possibility of dispatching data from the App.js component which at the moment I use to essentially…
LoF10
  • 1,907
  • 1
  • 23
  • 64
0
votes
0 answers

Some values not initialized in first test

I have a number of React/Redux actions & reducers that I want to test. I have successfully written a few tests, but I'm running into a problem on a reducer test where one value is being left as undefined in the first test, but properly initialized…
JESii
  • 4,678
  • 2
  • 39
  • 44
0
votes
1 answer

React/redux combineReducers issue

I'm trying to combine two reducers with redux: increment and decrement reducers. In my store.js file: With this line import reducer from "./reducers/increment"; the button increment works. With this line import reducer from "./reducers/decrement";…
Frankie
  • 181
  • 1
  • 1
  • 13
0
votes
1 answer

Sort reducer key by name in combineReducers - Redux - Typescript

I have a lot of redux reducers which are passed into combineReducers before sending it to the store. In js, I would generally do the below and it sorts. Please note that the reducers here are dummy. const reducers = { router:…
arunmmanoharan
  • 2,535
  • 2
  • 29
  • 60
0
votes
1 answer

Redux combineReducers() isn't recognising state

I am using redux combineReducers() to combine 2 reducers. While they are both recognised in dev tools, one of them is simply an empty object, even though I passed an object with different properties into the reducer. The combineReducers()…
Aejg
  • 71
  • 2
  • 8
0
votes
1 answer

How can I access state inside of my Redux cartReucer?

I need to access my current cart state which is just a list of products that have been added to the cart, so that I check ids in order to calculate quantity for duplicate products. I realize that one of my issues here is that i've initialized…
qb1234
  • 155
  • 2
  • 14