Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Latest commit

 

History

History
30 lines (23 loc) · 1.26 KB

01-react-create-a-user-interface-with-vanilla-javascript-and-dom.md

File metadata and controls

30 lines (23 loc) · 1.26 KB

01. Create a User Interface with Vanilla JavaScript and DOM

Notes

  • To create a user interface with JavaScript you will need a place to append your JavaScript DOM (Document Object Model) elements. This will be the root of our application.
  • Get access to that element using the document's API.
  • We create our element and add properties to it.
  • Finally, appended it to the DOM element.
<body>
  <div id="root"></div>
  <script type="text/javascript">
    const rootElement = document.getElementById('root');
    const element = document.createElement('div');
    element.textContent = 'Hello World';
    element.className = 'container';
    rootElement.appendChild(element);
  </script>
</body>

Additional resource