1 year ago

#377316

test-img

Naresh

using redux for state management , action is being triggered but reducer is not dispatching action

i am using redux for state management, redux-form to select a option from list of option initialised in state , every thing is working fine, when i am selecting option my action creator is receiving selected option with value as showen below in action file

action file code:

export const filteredResultsAction = (ftlr_status) => {
console.log("in action js file , show filtered Results method", ftlr_status);
 return {
   type: FILTERED_RESULTS,
   payload: ftlr_status,
  };
 };

but when i console out the action in reducer it is showing

enter image description here

reducer code:

const changeTempReducer = (state = INITIAL_STATE, action) => {
 console.log("seeing action in reducer", action.type);
 switch (action.type) {
   case FILTERED_RESULTS:
   console.log("s s s ", action.payload);
   return {};
   default:
    return state;
  }
   };

and initial state :

 const INITIAL_STATE = {
   options: [
  {
   label: "correct",
   value: "correct",
  },
  { label: "wrong", value: "wrong" },
  { label: "unattempted", value: "unattempted" },
 ],
 };

help me out where i am going wrong ?? thanks

reactjs

react-redux

react-hooks

redux-form

react-select

0 Answers

Your Answer

Accepted video resources