Documentation
Virtual DOM
stringToDOM()
💡

This function is part of the internal API. Only use if you know what you are doing and are optimizing for performance.


stringToDOM()

Syntax: stringToDOM(htmlString)
Example: stringToDOM('<div>Hello World</div>')

The stringToDOM function takes a string of HTML and returns a DOM object. This is useful for creating DOM elements from strings.

import { stringToDOM } from 'million';
 
const dom = stringToDOM('<div>Hello World</div>');
 
dom.innerHTML; // 'Hello World'
dom.tagName; // 'DIV'