You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we get the previous value of a key when working with connect? If not it would be great to have a feature like that to compare values to perform an update or not. Currently I'm handling it manually.
Like in @ changed
store.on("@changed",(state,change)=>{// we can get the changes})
I would expect something like this for connect:
connect("key",(previousState,state)=>{// we can compare states})
or
connect("key",(previousValueOfKey,state)=>{// we can compare values only not all state})
I think both would work.
The text was updated successfully, but these errors were encountered:
The idea of split your app: 1) state manage layer and 2) render layer. The connect will run only if the state is changed. The changing/check/update state you should manage in the modules.
store.on('add/item',(state,newItem)=>{if(state.items.length>100){return;// the state won't be update, if you return nothing}return{items: [...state.items,newItem],};});
In the module you have the current state and it should return partial of state that you want to update or undefined if you don't want to update state.
Can we get the previous value of a key when working with
connect
? If not it would be great to have a feature like that to compare values to perform an update or not. Currently I'm handling it manually.Like in @ changed
I would expect something like this for connect:
or
I think both would work.
The text was updated successfully, but these errors were encountered: