Utils I use
a simple create element function
import {createElement} from "@tamb/utils";
createElement({
type: "div",
text: "My text",
attributes: [["id", "yoyo"], ["classes": ["my", "many", "classes"]]],
children: {
...repeat
},
ref: "myRefName"
})
If you use .call
and bind to an object you can create a ref as a field name in that object
const x = {};
createElement.call(x, {
type: "div",
ref: "hey"
});
x.hey// will be your div
document.body.appendElement(createElement({type: "div"}));