3 ms·
The trick is to stop thinking XML/HTML and instead use functions which returns elements/components. First write the app in spaghetti code, then turn it into pu
by z3t4 6y ago
The trick is to stop thinking XML/HTML and instead use functions which returns elements/components.
First write the app in spaghetti code, then turn it into pure functions.
var app = todoList(data);
document.documentElement.appendChild(app);
- brabel 6y agoIn other words, the good old MVC pattern. (M) Model is your `data`. (V) View is what your function returns. (C) Controller is the functions your elements may use to mutate the data.
- srtjstjsj 6y agoMVC doesn't mean "has data, logic, and UI". MVC is a model for how the UI communicates with the data store.
- brabel 6y agoResponding to the wrong comment?? MVC is exactly what I said it is, check it here if you don't know: https://en.wikipedia.org/wiki/Model–view–controller https://en.wikipedia.org/wiki/Model–view–controller