Cradova Documentation

Learn how to build amazing web applications with Cradova


name: cradova description: Build web applications with Cradova - a lightweight reactive framework. Use when working with Cradova, creating web apps, building SPAs, or comparing frontend frameworks. Includes guidance on Signal-based state, hooks, routing, and performance optimization.

Cradova Framework

Cradova is a lightweight, reactive UI framework for building web applications. It uses direct DOM manipulation (no virtual DOM), signal-based pub/sub reactivity, and a VJS (Virtual JavaScript) specification instead of JSX.

When to Use Cradova

Critical Conventions

ALWAYS use regular functions, NOT arrow functions, for reactive components:

// CORRECT - regular function receives ctx with hooks
const MyComponent = function(ctx: Comp) {
  const [count, setCount] = ctx.useState(0);
  return div("Count: " + count);
};

// WRONG - arrow function does NOT receive ctx
const Broken = () => {
  // ctx is undefined - hooks will fail!
  const [count, setCount] = ctx.useState(0); // ERROR
  return div(count);
};

Why? Regular functions get a state tree from Cradova's rendering system. Arrow functions don't receive ctx, making them non-reactive. This convention controls how many state objects exist in the DOM.

Quick Start

import { div, h1, button, Page, Router } from "cradova";

// Create a reactive component using a REGULAR function
const Counter = function(ctx: Comp) {
  const [count, setCount] = ctx.useState(0);
  
  return div(
    h1("Count: " + count),
    button("Increment", {
      onclick() { setCount(c => c + 1); }
    })
  );
};

// Define a page
const HomePage = new Page({
  title: "My App",
  template: function(ctx) { return Counter(ctx); }
});

// Set up routing
Router.BrowserRoutes({
  "/": HomePage
});

Core Concepts

State Management

Routing

Control Flow

DOM Elements

See Also

Get Started in Minutes

Simple Setup

Follow our clear documentation to get your first project running in no time.

Write Less Code

Focus on your application's logic, not boilerplate.

Join the Discord

Get support and share your creations with a growing community.

Join Discord