React wrapper dev

From handsontable/handsontable · View interactive version

React wrapper dev is an AI agent skill from the GitHub repository handsontable/handsontable. Use when developing or modifying the @handsontable/react-wrapper package - React components, hooks, settings mapping, selection preservation during updateSettings, and the wrapper's TypeScript prop types and generated .d.ts. Use this whenever a task touches HotTableProps/HotColumnProps typing or IDE

How to use this skill

Skill file

React Wrapper Development

Package: wrappers/react-wrapper/ (see its AGENTS.md).

Components

Architecture

A useRef() holds the live instance, exposed via useImperativeHandle() (hotInstance.current). SettingsMapper.getSettings() converts props to a settings object; every prop change triggers updateSettings().

Critical rule: around updateSettings(), snapshot with selection.exportSelection() before and restore with selection.importSelection() after, or the selection resets on every prop change.

useHotEditor() builds component-based cell editors with access to the editor lifecycle (open, close, getValue, setValue). React portals render components inside cells (renderers, editors); a React context propagates the instance to them.

Build and test

Key files

| File | Purpose |

|---|---|

| src/hotTable.tsx | Public HotTable component |

| src/hotTableInner.tsx | Inner component with instance lifecycle |

| src/settingsMapper.ts | Converts React props to Handsontable settings |

| src/hotColumn.tsx | Declarative column config component |

| src/hotEditor.tsx | Custom editor portal component |

TypeScript prop types and the declaration build (read before touching `src/types.tsx`)

scripts/prepare-types.mjs generates the published .d.ts with this package's own typescript devDep (currently 3.8.2) and swallows tsc errors, so a mangled declaration still reports "prepared successfully."

React StrictMode

StrictMode double-mounts (mount, unmount, mount), so Handsontable initializes twice. Verify destroy() runs on unmount and no stale references persist, or the second mount fails or leaks.

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.