mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-27 18:13:08 +00:00
9 lines
341 B
JavaScript
9 lines
341 B
JavaScript
const injectTag = (tag, props, children) => {
|
|
const injectNode = document.createElement(tag);
|
|
Object.entries(props).forEach(([key, val]) => injectNode[key] = val);
|
|
if (children) injectNode.appendChild(document.createTextNode(children));
|
|
document.getElementsByTagName('head')[0].appendChild(injectNode);
|
|
};
|
|
|
|
export default injectTag;
|