Your first component

Plain Component

import { Component, html } from 'vistajs/dom';
import { bootstrap } from 'vistajs/boot';

const App = Component('my-component', () => {
  return  () => html`<p>Hello World</p>`;
})

const root = document.querySelector('#root') as Element;

bootstrap(root, App)

Binding values

Simple binding

import {Component, html} from 'vistajs/dom';
import {bootstrap} from 'vistajs/boot';

const App = Component('my-component', () => {
  const name = 'John'
  return  () => html`<p>Hello, ${name}</p>`;
})

const root = document.querySelector('#root') as Element;

bootstrap(root, App)

Property binding

Simple values

Reactive values

Last updated