← back

Coming from Vue / React

Tape's component model is directly inspired by the patterns you know — props down, events up, single-file components. The difference is it compiles to native code, not a JS bundle.

single-file components

Vue SFC

<template> + <script> + <style>. Three languages (HTML, JS, CSS) in one file.

Tape

#code + #view + #style. Same concept — one file, multiple concerns — but every section speaks tape syntax.

reactivity

Vue / React

Proxy-based reactivity driving a virtual DOM (Vue), or setState and a virtual DOM diff (React). The diff runs in the browser on every update.

Tape

var mutations set a dirty bit. The runtime repaints dirty components once per frame, however many mutations a handler made. There is no tree diff: only the if/for points that read changed state are re-evaluated.

events / emit

Vue

$emit('update', value): string event names, dispatched at runtime, and typed only if you declare them with TypeScript in defineEmits.

Tape

event on_update(val: i64) + fire on_update(val) — typed at compile time. Wrong handler signature = compile error.

conditional / list rendering

Vue / React

v-if / v-for (Vue) or {cond && <X/>} / .map() (React).

Tape

if (cond) { ... } and for (item in list) { ... } — same tape syntax inside view {}, re-evaluated when the state they read changes. List items are matched by key:, like a key prop.

what stays the same

  • - Props down, events up
  • - Single-file components
  • - Component state that triggers a re-render when it changes
  • - Conditionals and loops written inside the template
  • - Keyed lists: key: keeps each item's component when the list changes