Rendering

To render the component we can use the render() function.

Optionally, we can pass a DOM element or a Selector to indicate where the component should be rendered, the default is document.body:

import { _ } from "bemtv";

const { template, render } = _`App`();

template`Hello world!`;

// It can be called many times
render();

Another alternative is to import the render() method from the main module, it works similarly, but takes a string as the first argument and the element to render as the second:

import { _, render } from "bemtv";

const { template } = _`App`();

template`Hello world!`;

render("App[]", "#my-content");

Last updated