I am using react-redux and redux-persist in my react-native project it is working fine but when i tried to add object into redux state it is throwing this error
[TypeError: undefined is not an object (evaluating 'iter[Symbol.iterator]')]
My code inside reducer is
case ADD_FILES_DURATION:
console.log("data received",action.data);
return {
...state,
filesDuration: [...state.filesDuration, action.data]
};
and my state initial values are
const initialState = {
trackSpeed: "1",
filesDuration: [],
}
and from my homescreen i am trying to insert data into redux like this
const item = {
folderName: folderName,
track: trackName,
duration: duration
}
addFileDuration(item);
it is working fine for other redux operation but whenever i am trying to run this it is giving above error
Please help if anyone knows how to resolve this or any suggestions ?
After work around , i found what i was doing wrong
i was wrongly inserting data into redux that's the reason i was getting this error
So instead of this
const item = {
folderName: folderName,
track: trackName,
duration: duration
}
addFileDuration(item);
i used this
const item = {
"folderName": folderName,
"track": trackName,
"duration": duration
}
addFileDuration(item);
now it is working fine hope it may help anybody