case 'SHOW_ARCHIVED':
database.currentRoute = 'archive';
break;
let view = showTodos(todos) + showToggle(route);
I guess function present's argument can be called intent
not quite... all these semantic distinctions are very important. I am a "modeler" and semantics is essential here.
What kind of stuff would the action do that's beyond the scope of the model?
An AJAX request?
Yes, let's call it an API call to enrich the user data, validate it further, ... something the model does not care about. All the model cares about is that we present data that it can process
function present(<what to call this argument?>) {
showArchive()
and showInbox()
instead of dispatch('SHOW_ARCHIVE')
?
const makeState = db => {
= function makeState(db) {
~=
actually ^^
JSON = { key: 'value' }
listeners.map(l => l(state));
state = makeState(store);
// Update view
listeners.map(l => l(state));
makeState
b/c I'm pushing only visible TODOs into the state.
I defined
makeState
b/c I'm pushing only visible TODOs into the state.
Yes, that's the right way to do
if (state.inbox(model)) {
model.archive = data.archive || false;
model.todos = data.todos.filter(model.isArchived);