Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

103
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda