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

133
Visualizações
Selected item in createApi generated reducer

Currently, I have successfully built a redux-toolkit api using following code:

const api = createApi({
  reducerPath: 'api',
  baseQuery: baseQueryWithReauth,
  endpoints: (builder) => ({
    getClusters: builder.query({
      query: ROUTES.CLUSTERS,
    }),
  }),
})

The data Im receiving from backend looks like this:

  [
    {
      "name": "test 1",
      "description": "test 1",
      "id": 1
    },
    {
      "name": "test 2",
      "description": "test 2",
      "id": 2
    }
  ]

The user should be able to select one of these items through the interface, and the selection should be saved at redux. Something like:

{
  "data": [
    {
      "name": "test 1",
      "description": "test 1",
      "id": 1
    },
    {
      "name": "test 2",
      "description": "test 2",
      "id": 2
    }
  ],
  "selectedItem": 1 // Saved selected item id in redux so I can use it globally!
}

I have tried using createEntityAdapter and adding the selectId adapter, but seems not supported (I dont even know if its the correct approach). Is there any way to do it using redux-toolkit capabilities?

about 4 years ago · Juan Pablo Isaza
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