React is the most widely used frontend framework in the world and it’s using the same APIs that you’re using when it creates DOM nodes.
The Virtual DOM (V-DOM) is a lightweight, in-memory representation of the real DOM. Instead of updating the real DOM directly, frameworks like React update the Virtual DOM first.
Here’s how it works:
Programmatic React features:
React-dom contains features that are only supported for web applications (which run in the browser DOM environment). This section is broken into the following:
These files use a service called esm.sh to provide the React packages. Here’s a simple example of how to use the React createElement API:
import { createElement } from 'https://esm.sh/react'import { createRoot } from 'https://esm.sh/react-dom/client'const elementProps = { id: 'element-id', children: 'Hello world!' }const elementType = 'h1'const reactElement = createElement(elementType, elementProps)const root = createRoot(rootElement)root.render(reactElement)
The “props” in elementProps
above is short for “properties”. Props are a key concept
in React - they’re the way we pass data into our elements.
const elementProps = { id: 'element-id' }const elementType = 'h1'// Method 2: Multiple argumentsconst reactElement1 = createElement(elementType,elementProps,'Hello',' ','world!',)// Method 3: Array of childrenconst children = ['Hello', ' ', 'world!']const reactElement2 = createElement(elementType, elementProps, children)createRoot(rootElement).render(reactElement1) // or reactElement2
Quick Links
Legal Stuff
Social Media