const nextState = produce(state, draftState => { draftState.categories.forEach(category => { if (id === category.id) category.selected = !category.selected }) draftState.rni.forEach(item => { const nextState = produce(state, draftState => { draftState.categories.forEach(category => { if (id === category.id) { category.price = price const nextState = produce(state, draftState => { draftState[type].forEach(item => { if (id === item.id) { item.hours = hours