How to debug/log useful information inside immer callback?
If you serialize / de-serialize the draft, the output will be a plain JavaScript object and will appear as such in the console.
console.log(JSON.parse(JSON.stringify(draft)))
Immer 7+ has current()
for this purpose. So, you can do this:
import { current } from 'immer';
console.log(current(draft));
Official documentation and test