Skip to content

Live Preview

const mounted = mountForm(container, {
transport: createJsonTransport({ endpoint: "/api/predict" }),
schema,
});
const unsubscribe = mounted.form.subscribeSelector(
(state) => state.values,
(values) => {
preview.textContent = JSON.stringify(values, null, 2);
},
{ emitInitial: true },
);

Use selector subscriptions for previews, summary panels, and analytics. Avoid expensive work on every keystroke; debounce in the host app when needed.