Skip to content

Nice video! But just one minor remark... #4

@dotnetCarpenter

Description

@dotnetCarpenter

I enjoy the whirlwind tour of all those frameworks - five of those I didn't even know existed! I have only work with vue and react so seeing the other frameworks with a simple app was great. I was thinking it was too simple but it made it a lot easier to compare the frameworks at a glance.

My only remark is that HTML/DOM can be written more declarative than you show.

<!-- `return false` is equal to `event.preventDefault()` -->
<form onsubmit="addTodo(this.elements.todo.value); this.reset(); return false">
    <input name="todo" type="text">
    <input type="submit" value="Add Todo">
</form>
function createListElement(text) {
    const li = document.createElement('li');
    li.textContent = text; // faster and safer than .innerHTML
    return li;
}

function addTodo(todoText) {
    todoData.push(todoText);
    todoList.appendChild(createListElement(todoText));
    localStorage.setItem('todos', JSON.stringify(todoData));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions