Hi, thanks for the great lib, I'm really enjoying working with it so far.
I'm wondering if you have any suggestions for how I can implement history in my store. I'm struggling to grasp it because the store is only accessible as a draft inside setState, which is always going to be mutated, so as far as I can understand I can only ever do something like draft.history.push( draft ) or draft.history.push( draft.someProp ) within some existing action. Would that make sense? And then could I later even revert to it doing draft = draft.history.pop() or something along those lines?
I haven't really interacted directly with immer (only learned about it through your lib), but obviously draft is not a POJO. Should I look there? Is Middleware the right usecase for this? I'm really not sure...
Anyway I'm going to start trying various approaches and I'd greatly appreciate any insights you can provide to be able to wrap my head around this. Thanks!
Hi, thanks for the great lib, I'm really enjoying working with it so far.
I'm wondering if you have any suggestions for how I can implement history in my store. I'm struggling to grasp it because the store is only accessible as a draft inside setState, which is always going to be mutated, so as far as I can understand I can only ever do something like
draft.history.push( draft )
ordraft.history.push( draft.someProp )
within some existing action. Would that make sense? And then could I later even revert to it doingdraft = draft.history.pop()
or something along those lines?I haven't really interacted directly with immer (only learned about it through your lib), but obviously draft is not a POJO. Should I look there? Is Middleware the right usecase for this? I'm really not sure...
Anyway I'm going to start trying various approaches and I'd greatly appreciate any insights you can provide to be able to wrap my head around this. Thanks!