3 ms·
In MVC it is the Controller which handles all the events that happen upon the view. The view-"object" itself only does displaying, including updates to itself.
by galaxyLogic 3y ago
In MVC it is the Controller which handles all the events that happen upon the view. The view-"object" itself only does displaying, including updates to itself.
So a change in how the view looks does not trigger anything, it is user-actions caught by the Controller which do. These are the basic principles of MVC.
I don't know if you are using React or what, where the terms like View and Controller might have a different meaning, than in classic MVC.
My question more is about does React et al. use the principles of MVC and if not why not, and if yes why is a basic MVC framework not all we need to do change-handling.
- phailhaus 3y ago> it is user-actions caught by the Controller which do OK, and how does this work? The view is rendering the filter box, allowing the user to select an option. How does the Controller know what option was selected, if the view is not registering a click handler and communicating this up? What ends up happening is that as your application grows, so does the number of controllers, models, and views. A user action in one view can cascade to many different controller updates, which can overlap and conflict in difficult-to-debug ways, and render inconsistent data states. Flux architecture solves this, which is roughly what React is based on.