I am trying to unshift an array value with existing array by using spread operator approach. getting error. any one help me to get correct approach?
here is my code :
uploadedFiles : [...state.uploadedFiles.unshift( (<fileActions.UploadFileSuccess>action).payload ) ]
getting an error as :
The Number is not array type
Thanks in advance.
stateis a React state object. If so, you must never directly modify it (whichunshiftdoes). 2....isn't an operator. :-)