Functional components - onInst()

The onInst() method works the same way as onInit(), however the function passed as a callback will receive as its first argument a proxy of the component instance that was just created, with that all actions executed from that proxy are intended only for this instance, this simulates the behavior of functional components.

import { _ } from "bemtv";

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

onInst(({ click$, template }) => {

  click$(() => console.log("Hey!"));

  template`button[I am isolated from my sisters!]`;
});

Last updated