atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.18k stars 43 forks source link

Consider dumping virtual-DOM? I might help. #1

Closed eavichay closed 6 years ago

UpperCod commented 6 years ago

Hi!, I'll be honest I do not understand the concept of dumping virtual-dom, could you please explain the concept to me?

eavichay commented 6 years ago

Less memory usage, less package size. Why use virtual DOM if you don't really need it?

UpperCod commented 6 years ago

The virtual-dom has solved my problem in the generation of interfaces, I find it simple to maintain. Now if we talk about the need to use the virtual-dom, I have analyzed it but the use of binding has generated more code than the diff algorithm, If I would like to experiment in the creation of a static template system and use binding, the api could be something like this.

<div class="{this.myClass}">
    <button onclick="{this.myHandler}"></button>  
    <ul>
        <li :each="{item, index of this.myList}">
            {index} : {item.label}
        </li>
    </ul>  
</div>
import Template from "./template.html";

export default class extends Template{
    constructor(){
        this.myClass = "root-class";
        this.myHandler = [
            {label:"hello"}
        ]
    }
    myHandler(event){

    }
}

This would be for another project not for Atomico, it tells me if the idea seems interesting, we could work on it... I know how to generate bildings in cascade to avoid the virtual-dom, the advantage of this would be that if part of the view is generated as html without bildings, it remains as such and there is no analysis on that section of the view, the update would only be assigned to the binding.