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

196
Vistas
I tried toggling the alarm button to checked button for the targeted task but is not working

I tried toggling the alarm button to check button for the targeted task but the alarm icon of all the tasks change too. Am using the redux toolkit

This is my state

const initialState = {
  isHideForm: false,
  taskDesc: "",
  date: "",
  time: "",
  user: "",
  taskTitle: "",
  isEditing: false,
  editID: null,
  isCompleted: false,
  data: [],
};

Here is the reducer for toggling the button

 completed(state, action) {
      let item = state.data.find((x) => x.id === action.payload);
      if (item) {
        state.isCompleted = !state.isCompleted;
      }
    },

This is the on-click button

<button onClick={(e) => handleCompleted(e, d.id)}
                className="border-y-2 border-r-2 border-gray-200 p-2 rounded-r">
                {isCompleted ? <GrCheckmark /> : <FaBell />}
              </button>
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You've to return a new state object

if(item) { 
return {...state, isCompleted: !state.isCompleted }
}
about 4 years ago · Santiago Trujillo Denunciar
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