This function is part of the internal API. Only use if you know what you are doing and are optimizing for performance.
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'));