Skip to content

Instantly share code, notes, and snippets.

@MelodicCrypter
Created August 19, 2019 08:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save MelodicCrypter/b21c94cab5a1a0acafddadfa1c230315 to your computer and use it in GitHub Desktop.
Two utilities that will create node and append node to that parent node you just created. I've seen these somewhere else so I just shared to you as well.
// Utility for creating Nodes
export const createNode = element => {
return document.createElement(element);
};
// Utility for appending node to parent Node
export const appendNode = (parent, el) => {
return parent.appendChild(el);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment