Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 824 Bytes

react.md

File metadata and controls

28 lines (21 loc) · 824 Bytes
title
React Usage

React Usage

This documentation is best viewed on the documentation site rather than GitHub or NPM package site.

Embed Python Editor

Use {@link react.PythonEditorFrame | PythonEditorFrame} component to embed Python editor.

import { PythonEditorFrame } from '@microbit/python-editor-embed/react';

<PythonEditorFrame
  ref={ref}
  controller={1}
  controllerId="YOUR APP NAME HERE"
  initialProjects={async () => [pythonProject]}
  onWorkspaceSave={(e) => {
    // Set project as project changes in the editor.
    setSavedProject(e.project);
  }}
/>;

For more examples, take a look at the Python editor frame demo source code.