Answer the question
In order to leave comments, you need to log in
Why is props not updated after unshift and dispatch?
there is a code like this
.then(function answer(answer){
let clients_info = answer.data;
<b>currentList.unshift(clients_info);</b>
store.dispatch({
type: 'GET_clients',
setAdminData: currentList
})
})
.then(function answer(answer){
let <b>clients_info</b> = answer.data;
currentList.unshift(clients_info);
store.dispatch({
type: 'GET_clients',
setAdminData: clients_info
})
})
Answer the question
In order to leave comments, you need to log in
Took the current state, added an element to the beginning of the array. made dispatch of a new array.
let arr1 = [1,2,3,4]
let arr2 = arr1
arr2.unshift(1)
console.log(arr1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question