So, basically I want to remove one element from one of the inner arrays that is found inside the object. Though, the above code throws an error saying that splice cannot be invoked on an Immutable data structure. I though the call to asMutable() is going to convert it to a mutable object and store in posts variable. So basically asMutable() doesn't make the nested object mutable all the way? Because I also need at later stage to push into post.likes, not just remove an element as above. So, I want to make the whole object mutable so that I can work comfortably.
I'm using seamless-immutable inside React app, and I have a code segment like this in my saga:
And my
deleteLike
method looks like this:So, basically I want to remove one element from one of the inner arrays that is found inside the object. Though, the above code throws an error saying that splice cannot be invoked on an Immutable data structure. I though the call to
asMutable()
is going to convert it to a mutable object and store inposts
variable. So basicallyasMutable()
doesn't make the nested object mutable all the way? Because I also need at later stage to push intopost.likes
, not just remove an element as above. So, I want to make the whole object mutable so that I can work comfortably.