Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda