Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:0xranx OpenContext React

From Leeroopedia
Knowledge Sources
Domains Frontend, UI
Last Updated 2026-10-24 10:00 GMT

Overview

React 19 with Vite 5 build environment for the OpenContext desktop and web UI, including hooks, contexts, and service layers.

Description

This environment provides the React 19 runtime for OpenContext's UI components, hooks, and contexts. The UI is built with Vite 5 and uses Tailwind CSS, Headless UI, Heroicons, and dnd-kit for drag-and-drop. Components are written in JSX with PascalCase naming. The UI communicates with the backend via Tauri IPC commands (desktop) or HTTP API (web mode).

Usage

Use this environment for all UI component development, including idea journaling, document editing, agent chat, and search. It is the prerequisite for `IdeaService`, `AIContext_generateReflection`, `buildIdeaRefUrl`, `useAgentStreaming`, `useAgentSessions`, and `useDocLoader` implementations.

System Requirements

Category Requirement Notes
OS Cross-platform Dev server on any OS; desktop via Tauri
Hardware Any modern CPU 2GB+ RAM for dev server
Disk 500MB for node_modules Plus build output in dist/

Dependencies

npm Packages

  • `react` >= 19.0.0
  • `react-dom` >= 19.0.0
  • `react-router-dom` >= 7.11.0
  • `react-i18next` >= 16.5.0, `i18next` >= 25.7.2
  • `@headlessui/react` >= 2.2.0
  • `@heroicons/react` >= 2.1.5
  • `@dnd-kit/core` >= 6.3.1
  • `tailwindcss` >= 3.4.14 (dev)
  • `vite` >= 5.4.8 (dev)
  • `@vitejs/plugin-react` >= 4.3.1 (dev)

Credentials

No credentials required for the React runtime itself. API keys are injected via Tauri backend or Express API server.

Quick Install

# Start UI dev server
npm run ui:dev

# Build UI assets
npm run ui:build

Code Evidence

React 19 dependency from `package.json:118-123`:

"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router-dom": "^7.11.0",

Vite dev/build scripts from `package.json:21-23`:

"ui:dev": "vite --config src/ui/vite.config.js",
"ui:build": "vite build --config src/ui/vite.config.js",

React context pattern from `src/ui/src/context/AIContext.jsx:1-10`:

import React, { createContext, useContext, useState, useCallback, useEffect, useMemo, useRef } from 'react';
const AIContext = createContext(null);
export function AIContextProvider({ children }) {
  const [config, setConfig] = useState({ ... });
  // ...
}

Common Errors

Error Message Cause Solution
`Cannot find module 'react'` Dependencies not installed Run `npm install`
Vite HMR not working Dev server not started Run `npm run ui:dev`

Compatibility Notes

  • React 19: Uses new APIs like `use()` and improved Suspense. Not compatible with React 18 patterns that rely on `ReactDOM.render`.
  • Tauri desktop: When running inside Tauri, API calls go through Tauri IPC instead of HTTP. The `api.js` layer handles this transparently.
  • Mobile bridge: A separate mobile entry (`src/ui/src/mobile/`) loads the editor in a WebView.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment