DEV Community

Discussion on: Todo-MVP: Or 'Why You Shouldn't Use A Web Framework' - The Revenge

Collapse
 
nssimeonov profile image
Templar++

I checked the vanilla js TodoMVC... and I don't like it. Too much code for problems solved hundreds of times. Take for example the template:

    function Template() {
        this.defaultTemplate
        =   '<li data-id="{{id}}" class="{{completed}}">'
        +       '<div class="view">'
        +           '<input class="toggle" type="checkbox" {{checked}}>'
        +           '<label>{{title}}</label>'
        +           '<button class="destroy"></button>'
        +       '</div>'
        +   '</li>';
    }

And then using string operations the app is replacing values:

            template = template.replace('{{id}}', data[i].id);
            template = template.replace('{{title}}', escape(data[i].title));

So much code... and the more you write the more bugs you may have... this is exactly what we all are trying to avoid - reinventing the wheel again and again.

Thread Thread
 
codiiv profile image
Jay

Tadaaaa !!