Answer the question
In order to leave comments, you need to log in
Why does the data in State change when an element is removed from another array?
I don’t want the state to change, but I can’t understand what is the relationship of the state with this array
export const SHOW_RESULTS_WHEN_NOTHING = (state) => {
let selectedFilters = {...state.selected.filters},
arrayWithFilters = []; //Я удаляю элемент с этого массива, ниже в фориче, и тот же элемент удаляется из объекта стейте state.selected.filters
for (let filter in selectedFilters) {
arrayWithFilters.push(selectedFilters[filter])
}
arrayWithFilters.forEach((filter) => {
if (filter.values.includes('qcontrast')) {
filter.values.splice('qcolor', 1);
console.log(filter)
}
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question