Skip to content

A good starting point if you want to make your own reactive library like react.js, with cold simple vanilla js

License

Notifications You must be signed in to change notification settings

arnavzek/tree.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tree.js

A good starting point if you want to make your own reactive library like react.js, with cold simple vanilla js & without classes

how to use: in the main function(){

twig({ 
   name: "counter", //you declare a new component with twig()

   addCount: function(){
       this.setState({count: this.state.count+1}) // our sweet setState 
   },
            
   ui:function(){
       return $('button', {
         text:this.state.count, onClick: addCount 
       } ) 
   },
            
 })

 tree({
       build: [ counter() ] //counter can have build method and it's childs and it's child can have child... quite like html but with js and
                            //you can pass in new functionality as parameters
   }) 

        
}

check out todo_app.html

#Benefits over conventional react library
*It doesn't depend on prop instead you use this.parent, so twigs(components) are easily swappable
*all method of the component are binded by default
*components are real functions, pass methods as parameter and it will be applied to the twig

#wip three.js canvas support new diffing algorithm

About

A good starting point if you want to make your own reactive library like react.js, with cold simple vanilla js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages