Docs
Internals
mount()
⚠️

This function is part of the internal API. It is intended for developers creating their own frameworks. It is not recommended for general use.


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.

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