Skip to main content

@enclave-vm/react

React hooks and components for building interactive code execution UIs with the EnclaveJS streaming runtime.

Installation

Peer Dependencies:
  • react >= 17.0.0

Quick Start

EnclaveProvider

The provider sets up the EnclaveClient context for your application.

useEnclaveSession Hook

The main hook for executing code and managing session state.

Basic Usage

Session States

Options

Return Value

useEnclaveClient Hook

Access the underlying EnclaveClient directly.

useEnclaveContext Hook

Access the full context value including client and configuration.

Examples

Code Editor with Output

With Tool Calls

With Cancellation

Multiple Sessions

TypeScript Types