virtualdom.reactwidget.tsx 351 B

123456789101112131415
  1. import * as React from 'react';
  2. import { Widget } from '@lumino/widgets';
  3. import { ReactWidget } from '@jupyterlab/apputils';
  4. function MyComponent() {
  5. return <div>My Widget</div>;
  6. }
  7. class MyWidget extends ReactWidget {
  8. render() {
  9. return <MyComponent />;
  10. }
  11. }
  12. const myWidget: Widget = new MyWidget();
  13. Widget.attach(myWidget, document.body);