Is it ok that `prev` and `state` in onStateChange handler return same values?
voronianski opened this issue · comments
Please take a look at my example (pls open console to see logs).
On every 'counter:increment'
action onStateChange
handler logs the same values for state.counter.count
in state
and prev
objects:
Is it intended?
Also I'm a bit confused that inside choo.js onStateChange
function has different signature - https://github.com/yoshuawuyts/choo/blob/master/index.js#L89
@yoshuawuyts I really like the concepts and minimal API of the library and would like to use it inside of my project but this issue stops me for now.
currently thinking of actually ditching the prev
argument because it causes a fair amount of complexity in the API - wouldn't rely on it tbh
Instead you can hold your own reference to the prev instance of state
, for example inside a closure (: