4 ms·
> That’s a link to a route handler (controller) that makes a graphql call (model) and then explicitly updates the DOM with renderComponent (view). See, we're a
by randomdata 2y ago
> That’s a link to a route handler (controller) that makes a graphql call (model) and then explicitly updates the DOM with renderComponent (view).
See, we're already not talking about MVC. Under MVC, the model updates the view. But, as you say, in your code the "controller" does the updating. Maybe you could argue that React is serving the role of the model here by actually being the place where the DOM gets updated, but, ultimately, we're always going to struggle with finding such analogies when React isn't designed for the MVC model.
- breadwinner 2y ago> Under MVC, the model updates the view. Nope. Under MVC, models knows nothing about view.
- randomdata 2y agoRight, but the model does know everything about signalling change. Under MVC, the model is responsible for updating the view through the passage of messages. Which is essentially one major part of what React tries to offer. Granted, in an ugly way as it has to deal with the harsh limitations of Javascript instead of having the power of Smalltalk to work with, but such is life.
- williamcotton 2y agoSo then you probably, unlike most, don’t consider something like Rails to be MVC?