I'm trying to trigger the extra reducers, everytime when i dispatch the fillForm action. but the code isn't working. Any help ?
export const userSelectSlice = createSlice({
name: "userSelect",
initialState: {
name: localStoreData?.name || "",
salary: localStoreData?.salary || "",
job: localStoreData?.job || "",
location: localStoreData?.location || "",
eligibility: localStoreData?.eligibility || "",
},
reducers: {
fillForm: (state, action) => {
state.name = action.payload.name;
state.salary = action.payload.salary;
state.job = action.payload.job;
state.location = action.payload.location;
localStorage.setItem(
"userSelect",
JSON.stringify({
name: action.payload.name,
salary: action.payload.salary,
job: action.payload.job,
location: action.payload.location,
})
);
},
},
extraReducers: (builder) => {
builder.addCase(createAction('fillForm'), (state, action) => {
// extra reducer code goes here
console.log('sdcjknsdcjnsdjhcbsdjhb')
state.eligibility = 'sdckjsdcjnsdjcbdshjcb'
});
},
});
I tried several methods but wheren't of any help