I have an issue regarding Actions. When I console.log the state inside an action, i get a proxy which I suspect is Immer underneath.
0: Proxy
[[Handler]]: null
[[Target]]: null
[[IsRevoked]]: true
length: 1
What do I have to do to get the value from the proxy apart from JSON.stringify?
Hmmm, yeah, not ideal but you may need to extract the original object as discussed in the immer docs:
https://github.com/mweststrate/immer#extracting-the-original-object-from-a-proxied-instance
Out of interests sake. Does the redux dev tools not help with this case?
@ctrlplusb Thanks for your reply. Using original seems to do the trick. I will leave this here for reference
import { original } from 'immer'
console.log(original(state.myObject))
Out of interests sake. Does the redux dev tools not help with this case?
Well unless I am mistaken redux dev tools show before and after, in my case I wanted to see what happens between before and after, in my action.
Out of interests sake. Does the redux dev tools not help with this case?
Just to give more information on this, I don't really use Redux tools. I've always found leaving console a little too much trouble ;)
Most helpful comment
@ctrlplusb Thanks for your reply. Using
originalseems to do the trick. I will leave this here for referenceWell unless I am mistaken redux dev tools show before and after, in my case I wanted to see what happens between before and after, in my action.