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

132
Views
Elemento seleccionado en el reductor generado por createApi

Actualmente, he creado con éxito una API redux-toolkit usando el siguiente código:

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

Los datos que estoy recibiendo del backend se ven así:

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

El usuario debería poder seleccionar uno de estos elementos a través de la interfaz, y la selección debería guardarse en redux. Algo como:

 { "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! }

Intenté usar createEntityAdapter y agregar el adaptador selectId , pero parece que no es compatible (ni siquiera sé si es el enfoque correcto). ¿Hay alguna forma de hacerlo usando las capacidades redux-toolkit ?

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