3 ms·
How "Declarative" and "this.state.count++;" can be used together?
by rmrfchik 4y ago
How "Declarative" and "this.state.count++;" can be used together?
- epolanski 4y agoBy the way "declarative" doesn't really mean anything with very specific boundaries. Would've been that better if you had some `increment(state)` that updated a ref anyway?
- rmrfchik 4y agoNo, it's has the same semantic. Method can return the whole new state, the changed fields or actions to be taken. Or method can call the passed continuation with changed values instead of return.
- pygy_ 4y agoThe view DSL is declarative (as most are). By definition, controllers must be imperative.
- rmrfchik 4y agoThey must not be imperative. As a quick reference erlang with OTP. One can emit new state without modifying old state.
- playingalong 4y agoImmutable data structures != declarative.
- satvikpendem 4y agoBecause you're not creating and updating nodes like in jQuery. You lay out a view, declaratively, fill out the holes where you want state, ie counter values, and then you have controllers to fill that out. When state changes, you recompute the entire view rather than imperatively changing out DOM nodes.