Documentation
Virtual DOM
mount()

mount()

Syntax: mount(Block, el)
Example: mount(block, document.getElementById('root'))

The mount function is used to mount a block to a DOM element (imagine ReactDOM.render() in React). It takes two arguments: the block to mount and the DOM element to mount it to. The block will be mounted to the DOM element and all of its children will be mounted to the DOM elements that they are bound to.

import { block, mount } from 'million';
 
const display = block(({ text }) => {
  return <p>{text}</p>;
});
 
const element = mount(display, document.getElementById('root'));