0.2.1 • Published 2 years ago
@ttws/eric v0.2.1
ERIC
ERIC is for Entity React Iterative Component.
It tries to describe hierarchical data as flat maps of entities.
It's like ECS but managed by React, for the following benefits:
Shallow React tree meaning updates are mostly local.
Easier to do hierarchical changes while avoiding rerenders.Mount entity management systems as components.
Easier to modularize and accurately control lifecycles.Generic entity map structure that can be loaded from HTML
Easier data scaffolding with template languages
Usage
Declare entities in a html template
tag.
deck#root
card.face-down(suit="clubs" rank="A")
card(suit="hearts" rank="2")
Declare entity map commands.
export const cmds = {
count({data, args}){
return data[args[0]]?.children?.length || 0;
}
}
Load app.
ERIC.loadEricApp({ template: '#eric-template', cmds });