R
R
rd1002021-09-22 21:31:56
JavaScript
rd100, 2021-09-22 21:31:56

How true is this entry for mvc?

There is a folder productin which there is another folder productwith a file product.jsin which there is a class that ProductClassstores all the methods of this page.
An instance of it is controller.jsimported ProductClassand created, and all links to the buttons that call these methods are also there, and handlers are hung on them there.
From what visually changes, there is only one function and code for 10 lines.

product
  - product
      - product.js
   - controller.js


How relevant is it to create a separate folder viewfor this one function, if it is ProductClassconvenient thisto use it in the class, because it is called from another method by the function.
And how convenient it is to assign event handlers to buttons if we can shove them into the constructor ProductClass.
As I understood from the theory MVC, there should be 3 files.
Where modelI product.jsget controllerit is controller.js, viewnot created, but it has one function that renders our product page.

Please do not judge strictly, but help me figure out what I may not have understood correctly from the book.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question