Re:Show HN: Cell.js – A Self-constructing web app framework
by meekaaku on Sunday June 11, 2017 @08:30PM
(#14534572)
This is interesting. I have had a look at the examples. One question that comes to mind, how do you make a reusable component? Say I have:
Part = {
$cell: true,
$type: "h2",
$text: "Part No: ",
}
Part is to be instantiated multiple times in the same page, but I want different $text. How do I pass this data?
[ Parent
| on HN ]
Re:Show HN: Cell.js – A Self-constructing web app framework
by tmzt on Sunday June 11, 2017 @08:45PM
(#14534603)
It seems to use functions for that purpose, look at the example with map.
I really like the linked to Android/iOS implementation of this concept.
Re:Show HN: Cell.js – A Self-constructing web app framework
by meekaaku on Sunday June 11, 2017 @09:13PM
(#14534700)
Ok. I found a way using factory:
ItemMaker = function(data){
return {
$cell: true,
$type: "h1",
style: "font-size: 100px;",
$text: data,
}
}
var i1 = ItemMaker('foo');
var i2 = ItemMaker('bar')