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

192
Views
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 answers
Answer question

0

You've to return a new state object

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