Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

93
Views
Expected to find one of the known reducer keys instead: "user". Unexpected keys will be ignored

I am trying to use Redux to update a users profile. I keep getting the error

Expected to find one of the known reducer keys instead: "user". Unexpected keys will be ignored.

I have my store created with this:

import {configureStore} from '@reduxjs/toolkit';
import userProfileReducer from './slices/user';

const store = configureStore({
  reducer: {
    user: userProfileReducer,
  },
});

export default store;

The userSlice is below which is getting the error. I am passing the initial state and then using that to send to the reducer:

const initialUserState = {
  user: {
    email: '',
    name: '',
    phoneNumber: '',
    isAdmin: false,
  },
};

const UserSlice = createSlice({
  name: 'user',
  initialState: initialUserState,
  reducers: {
    user(state, action) {
      state.email = action.payload.email;
      state.name = action.payload.name;
      state.isAdmin = action.payload.isAdmin;
      state.phoneNumber = action.payload.phoneNumber;
    },
  },
});

export const userActions = UserSlice.actions;
export default UserSlice.reducer;
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The first problem that I can spot is that you have one level of too deep nesting. It should be:

const initialUserState = {
  email: '',
  name: '',
  phoneNumber: '',
  isAdmin: false,
};

Does this solve the above problem?

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!