Creating components

To create a component we can import the symbol/function _, it takes the name of the component(using tagged templates) as the first argument which must always start with an uppercase character (CamelCase) and accepts all alphanumeric characters and the : symbol.

import { _ } from "bemtv";

_`App`;

The component names must be unique, to avoid conflicts we can use the : symbol to indicate a component that is related to something:

import { _ } from "bemtv";

_`Menu:Links`;

Component instance

The function that creates components returns another function that optionally takes an argument and returns an instance that we will use to access special methods and properties, one of these methods is template():

import { _ } from "bemtv";

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

Last updated