'[TypeError: undefined is not an object (evaluating 'iter[Symbol.iterator]')] react-native

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 ?



Solution 1:[1]

This error made no sense to me as I was using another reducer with the same logic, turns out all you have to do is restart your project (I also deleted the app from my simulator)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rohan Rajesh