Questions tagged [redux-reducers]

195 questions
0
votes
2 answers

Attempted import error: './redux/reducers/configureStore' does not contain a default export (imported as 'configureStore')

I'm starting learn React + Redux , I'm doing a simple application for add or remove a counter . But I have a problem on a reducer . I try a lot of things without result... Thanks in advance :) Here is my code : The reducer : import * as actionTypes…
0
votes
1 answer

Redux Action not getting passed to reducer

I am trying to trying to get my textbox to update the word count when the user types something in the box. But the setWordCount action is not getting passed to the reducer. I am at a loss for why this isn't working. In troubleshooting, I confirmed…
0
votes
1 answer

react Reducer - overwriting item but instead a double is generated

i want to change the existing item with following function, but instead of overwriting a new item will be created. Whats my mistake ? case "EDIT_KSTORY": return state.map((storie) => { if ( storie.stories.storieID === action.sID && …
Maxxxus
  • 3
  • 2
0
votes
1 answer

high-order reducer in a react-redux project

I joined a project which is written in React.js with redux and saga. Reducers in the store are written with the use of pipe function: export const HighestOrderReducer = (...higherOrderReducers) => (baseReducer) => higherOrderReducers.reduce( …
Eli
  • 41
  • 7
0
votes
0 answers

Redux connected React component not updating until a GET api request is recalled

My react app uses a redux connected component to render data from backend for a project page, so I called a GET dispatch inside a React Hook useEffect to make sure data is always rendered when the project page first open, and whenever there is a…
0
votes
1 answer

Why am I getting unexpected results with state custom class method in reducer?

I'm getting unexpected state handling in the redux reducer. If I'm using the following code to handle selectPackage action, I'm getting the wrong state when the reducer is done. Upon further inspection, it turns out that the selectPackage method in…
lavee_singh
  • 1,379
  • 1
  • 13
  • 21
0
votes
1 answer

Reducer not receiving action in redux or trouble with the action being called

I'm working on a MERN Stack. The database is posting to the route correctly, but the reducer is not receiving the action when trying to read all the database entries. It's possible that the action readAllEmployment() is not being hit by the front…
WasteOfADrumBum
  • 217
  • 2
  • 12
0
votes
1 answer

How to split one Redux reducer into multiple smaller ones

I'm very new to React & Redux and am working on the authentication portion of my app. The way my backend API works is, once a user signs in, the response contains: The JWT token to use for future requests An object with the User's data What I…
John Bustos
  • 19,036
  • 17
  • 89
  • 151
0
votes
1 answer

remove an item from the array via an action

I want to make remove item reducer add item reducer is : export const addItems= (state= [], action)=> { switch (action.type) { case 'ADD_ITEM': return [ ...state, action.product ] …
0
votes
1 answer

Reducer functions don't work in react-native, redux?

So I am trying to learn redux by following this video: https://www.youtube.com/watch?v=bvn_HYpix6s&list=PLGNi8CcDr1dLmW4ZzSMvf4gqfobXhSPlX&index=3&t=7181s Trying to implement a map and created my data layer with setOrigin, setDestination and…
OzzyOsbourne
  • 45
  • 1
  • 8
0
votes
1 answer

How to get a React Redux state value from the reducer?

In Redux, I currently have a state that looks something like the following. { activeConversation: "Jim" conversations: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}] } I'm also using socket.io to send messages to other users. export const newMess =…
Josh Susa
  • 385
  • 1
  • 6
  • 13
0
votes
1 answer

Unhandled Rejection (TypeError): Cannot read property 'someProperty' of undefined

I have this error when I press my "Marcar" Button: My "Marcar" button fires this thunk: import axios from "axios"; import { addNewNote, binnacleNoteReview, loadBinnacleNotes } from "../Actions/notes.actions"; export const markNoteReview = (role,…
Diego Duarte
  • 79
  • 1
  • 6
0
votes
1 answer

Refactoring with createSlice reduxtoolkit

I'm having trouble refactoring with createSlice, I'm a beginner with redux-toolkit and have looked through the documentation but still having problems.if someone could point me in the right direction that would be fantastic. This is the working…
Ricksta
  • 27
  • 1
  • 4
0
votes
1 answer

spread state in react redux

I want to know what does ...state inside { ...state } do? Is it to change the value of the store to the initial value or to let the store be the latest value? import * as actionType from "../actions/actionTypes"; const initialStore = { …
Rawand122
  • 327
  • 1
  • 5
  • 12
0
votes
1 answer

How to structure data reducers in Redux-toolkit with multiple apis

I'm beginner developer developing an application with react using typescript and redux-toolkit (mainly with createSlice, createAsyncThunk). I'm still confused on how to structure/manage data with multiple data apis for example : there are 3…