Skip to main content

Getting started in TypeScript

Install

npm install @datalayer/reactor

react and react-dom (>= 18) are peer dependencies, and only needed if you use the React bindings.

Build from source

npm install
npm run build

npm run build builds the runtime (lib/) and the bundled plugins under plugins/.

A plugin, a platform, a start

import { buildReactorFromPlugins, definePlugin } from '@datalayer/reactor';

const DemoPlugin = definePlugin({
name: '@demo/core',
build() {
return { message: 'hello' };
},
});

const reactor = buildReactorFromPlugins([DemoPlugin]);
reactor.start();

That is the whole minimum: a name, something to build, and a platform to run it on.

Core vs React

The runtime is framework-agnostic; the React integration is a separate entry point, so a backend-for-frontend or a CLI can use the same platform without pulling React in.

import { definePlugin } from '@datalayer/reactor'; // core runtime
import { ReactorSlot } from '@datalayer/reactor/react'; // React bindings

Where to go next

You want toRead
declare a plugin properly, with presentation metadataPlugins
understand phases, enable/disable and disposalLifecycle
let plugins offer things the app chooses betweenContribution points
ship several plugins as one capabilityExtensions
not load a plugin until something asksActivation events and Lazy loading
render all of itReact bindings