Defining the template

The template() method should be used to define the content that the component renders.

It accepts an argument that must be a string, TemplateStringsArray or a function:

import { _ } from "bemtv";

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

template`Hello world!`;

We should only use a function when the content of the template can be changed by a variable above:

import { _ } from "bemtv";

let count = 0;

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

setInterval(() => count++, 1000);

template(() => `Count is: ${count}`);

Last updated