Docs
Internals
mount()
⚠️

This function is part of the internal API. You should only be using this if you are making your own framework.


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'));