0

I have been learning magento since past 2 months but i have been stuck at a point in learning .

What i can't understand is Why there are 3 folders in JS of checkout_module VIEW,ACTION,MODEL are they for any reason or they just created it to keep file separate for better knowledge and understanding

1
  • If you need any files please let me know
    – Abhishek
    Commented Jun 9, 2023 at 12:50

1 Answer 1

0

Magento2 source code (at least for the javascript part) separate folders depending on the use case. I'm assuming you talk about the Magento_Checkout module

Since Magento2 use KnockoutJs there is a view folder to contain view model of these components (there surely all have a .html in the template folder with the same path or so).

The action folder contain functions to call to perform "action" like making an order or adding an item to cart.

The model is often use to interact with the local storage or data object.

I don't think there's a convention on how to store your javascript files other than storing them in Vendor_Module/view/frontend/web/js folder. I think it's better to organize your code like the code source.

Also I'm still learning so my answer may not be totally complete.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.