Re:Vue.js: the good, the meh, and the ugly
by buremba on Thursday July 05, 2018 @04:56PM
(#17466767)
I wonder how you avoid writing stateful components in real-world complex SPAs.
[ Parent
| on HN ]
Re:Vue.js: the good, the meh, and the ugly
by williamdclt on Thursday July 05, 2018 @05:26PM
(#17466971)
Quite easily. The state is held in Redux or whatever, the only state held by components are UI stuff (is this section collapsed? Is this date picker open?).
In the last SPA I wrote there's about 100 components, less than 5 of them are stateful.
Re:Vue.js: the good, the meh, and the ugly
by ilovecaching on Thursday July 05, 2018 @05:04PM
(#17466836)
It's quite easy, I honestly think the only roadblock is how one thinks about computation. If you think of your UI as a single computational expression you're building up from functional composition, then the issue of state never arises. It's just about defining the shape of the interfaces.
Re:Vue.js: the good, the meh, and the ugly
by buremba on Thursday July 05, 2018 @05:24PM
(#17466963)
Sounds cool but I can't actually imagine the way you described. :) Any tutorials, articles?
try working through some tutorials on erlang/otp supervisor trees. the concepts are very similar.
Re:Vue.js: the good, the meh, and the ugly
by 33degrees on Thursday July 05, 2018 @05:08PM
(#17466866)
You manage your state outside your components, using Redux / Relay / MobX etc...
Re:Vue.js: the good, the meh, and the ugly
by The_suffocated on Friday July 06, 2018 @10:46AM
(#17471804)
Discussions of this sort are often confusing. When one talks about using Redux or some javascript library to do "state management", I always wonder whether one is talking about application states (i.e. states originating from business logic but unrelated to UI) or UI states.
Re:Vue.js: the good, the meh, and the ugly
by infinite8s on Friday July 06, 2018 @03:32PM
(#17474418)
Application states. Redux isn't meant to maintain UI state.