C&C Docs
Log in
Code

The React target — a widget as a React component

The widget an app renders on the server is also importable as a native React component by an app that is not a cnc app at all — the template transpiled to createElement calls, props as props, events as callbacks. The server supplies the component, its types and its styles; the consuming app supplies React. No plugin, no loader, no copy maintained by hand.

A React app, rendering them

The frame is a static page — not a cnc block — that brings React 19 from a CDN through an import map and imports CncButton, TBadge, its solid variant and TCounter from this server. Press the button: the callback is the consumer's. Press the counter's +: nothing changes, because declared state is a prop and the widget's behaviour stayed behind.

the frame says: waiting for the framed React app…
// In an app that is not a cnc app at all:
import { CncButton } from 'https://your-host/@cnc/widgets/react/CncButton'

<CncButton kind="primary" label="Save" onClick={() => save()} />

// Types:  /@cnc/widgets/react/CncButton.d.ts
// Styles: /@cnc/widgets/react/CncButton.css
// Pinned: /@cnc/widgets/react/manifest.json → CncButton.<digest>.mjs