dependabot[bot] on npm_and_yarn
Bump terser from 5.14.0 to 5.14… (compare)
dependabot[bot] on npm_and_yarn
Bump shell-quote from 1.7.2 to … (compare)
pakastin on gh-pages
Updates (compare)
pakastin on master
3.29.0 (compare)
pakastin on v3.29.0
3.29.0 (compare)
pakastin on master
Don't use DOM memoization (compare)
But what about components?
Example:
RE:DOM today:
class Lightbox{
constructor(props, ...childs){
const style = Object.assign({color:"red"}, props.style || {});
this.el = el("div.lightbox", {style}, childs);
}
}
const app = () => {
return el("div",
new Lightbox({ style:{color:"green"} },
el("h2", "Lightbox h1")
)
)
}
mount(document.body, app());
With el:
class Lightbox{
constructor(props, ...childs){
const style = Object.assign({color:"red"}, props.style || {});
this.el = el("div.lightbox", {style}, childs);
}
}
const app = () => {
return el("div",
/* new Lightbox... */ el(Lightbox, { style:{color: "green"} },
el("h2", "Lightbox h1")
)
)
}
mount(document.body, app());
setChildren
and it exploded due to call stack size exceeded
setChildren(elem, this.getChildElems());
it recursed forever and died
el('li', 'Some text', var, 'more text')
btw.. ;)
setChildren
only allows Nodes or components as children, not Strings..
setChildren(elem, ['some text', var, 'more text'].map(text))
..
import { text } from 'redom'
I mean..
el('li', this._getChildElems())
and the child elems function returned a dynamic list of strings and elements. like ['Some text', el(...), 'some more text']
el
but not setChildren
, but I will use that text
function :)
setChildren
and mount
are helpers for appendChild
/insertBefore
, so they need Node / component..
el
is a bit different, since it's document.createElement
helper..
setChildren
as well..
api
along. Then I use that to trigger updates to the state.