Does updating state always update DOM? #1061
-
Hello! I've been picking through the hyperapp code and I can't decide whether setting a property to the same value within the state will update the DOM. For example: function action(state) {
return {
...state,
show: true
}
} Whereby state.show was already set to true. I think this will cause the view to regenerate and may or may not update the vdom which may or may not update the dom. I could do a check before the return to see if the value is the same and return the previous state however this simple example is masking some of the complexities of what I'm trying to achieve. Please could someone clarify what happens when property values are set to the same value within updated state. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Updating the state will always update the DOM, but setting a property to the same value will not because that does not constitute a state update. We skip DOM updates here. |
Beta Was this translation helpful? Give feedback.
Updating the state will always update the DOM, but setting a property to the same value will not because that does not constitute a state update. We skip DOM updates here.