Removing items from a normalized reduction store

Please review this question first. I use this sample object that everyone has used.

{ entities: { plans: { 1: {title: 'A', exercises: [1, 2, 3]}, 2: {title: 'B', exercises: [5, 6]} }, exercises: { 1: {title: 'exe1'}, 2: {title: 'exe2'}, 3: {title: 'exe3'} 5: {title: 'exe5'} 6: {title: 'exe6'} } }, currentPlans: [1, 2] } 

When the user clicks "Delete exercise", the message may look something like this:

 {type: "REMOVE_EXERCISE", payload: 2} 

Do I need to iterate over all the plans, and then all the exercises within each plan to remove this element? How will this be done in the gearbox?

+5
source share

Source: https://habr.com/ru/post/1258243/


All Articles