React Wrapper Development
SkillProductivityUse 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 autocomplete for <HotTable>/<HotColumn> props, the declaration build, or a report that React/TypeScript users get no prop suggestions - even if the wrapper is not named explicitly.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the React Wrapper Development skill
What this skill tells your AI
The instructions your AI receives, as published by handsontable/handsontable in .claude/skills/react-wrapper-dev/SKILL.md and read by ahel’s review.
Package location
wrappers/react-wrapper/
Components
- HotTable - the public component users import. Renders a container div and bootstraps Handsontable.
- HotTableInner - a
forwardRefwrapper that handles the actual instance lifecycle. - HotColumn - declarative column configuration as a child of HotTable.
- HotEditor - renders a custom editor component inside a React portal.
Architecture
A useRef() hook holds the live Handsontable instance. It is exposed to parent components through useImperativeHandle(), so consumers can call hotInstance.current to access the grid API directly.
SettingsMapper.getSettings() converts React props into a plain Handsontable settings object. Every prop change triggers updateSettings() on the instance.
Critical rule: When calling updateSettings(), you must preserve and restore the current selection. Before the call, snapshot the selection with selection.exportSelection(). After the call, restore it with selection.importSelection(). Forgetting this causes the selection to reset on every prop change.
Custom hooks and portals
useHotEditor()- a hook for building component-based cell editors. It gives the editor component access to the editor lifecycle (open, close, getValue, setValue).- React portals are used to render React components inside Handsontable cells (for renderers and editors). A React context propagates the Handsontable instance to these portals.
Build and test
- Build system: Rollup 4 producing CommonJS, ES module, UMD, and minified outputs.
- Tests: Jest with React Testing Library.
- Run tests:
npm run test --prefix wrappers/react-wrapper - Important: Build core first with
npm run build --prefix handsontable. Wrappers consumehandsontable/tmp/, notdist/.
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)
The published .d.ts files are generated by scripts/prepare-types.mjs, which runs this package's own typescript devDep — currently 3.8.2 (2020) — and deliberately swallows tsc errors, so a mangled declaration still reports "prepared successfully."
- Define modern type helpers in the core package and import them here. TS 3.8 cannot emit 4.1+ syntax such as key-remapping (
{ [K in keyof T as ...]: ... }); it silently produces garbage like{ [K in keyof T]: ; }. Keep such helpers inhandsontable/src(built with modern TS) and import them, e.g.RemoveIndexSignaturelives inhandsontable/src/settings.tsand reaches the wrapper viahandsontable/base. - After changing any type in
src/, verify the emitted declaration. Pack the core and wrapper (npm pack), install both into a throwaway project, andtsc --noEmita file that uses the props — this is the reliable signal, since the build itself hides declaration errors. - Strip the index signature before
Omit/Pickon a settings type.GridSettings/ColumnSettingscarry a[key: string]: anyescape hatch for plugin/meta keys. Wrap the input inRemoveIndexSignature<T>first (asReplaceRenderersEditorsdoes) so the named options surviveOmit— without itkeyofwidens tostring, every option name is dropped, and IDE autocomplete inside<HotTable>/<HotColumn>breaks. Build column props fromRemoveIndexSignature<GridSettings>and overridedatawithColumnSettings['data']— do this in the wrapper rather than making coreColumnSettingsstrict, because tightening a shipped core type breaks existing loose column configs (columns: [{ validator: (v: string) => … }]) across every framework. (Interfaceextendskeeps the options but can't overriderenderer/editor/data, whose types differ.) Finally, re-add& { [key: string]: any }to the prop type so undeclared cell-type/plugin options (correctFormat,datePickerConfig, …) stay assignable; named options keep their real types regardless, exactly likeReact.CSSProperties. A prop type without this hatch fails on real configs (e.g. adatecolumn passingcorrectFormat). - Lint through the monorepo-level lint command. This package has no
lintscript or local.eslintrc, so run the root lint (which supplies the TS/JSX-aware parser) rather than a per-file invocation.
React StrictMode gotcha
React StrictMode causes a double mount (mount -> unmount -> mount). This means Handsontable gets initialized twice. The wrapper must correctly destroy the instance on unmount and create a fresh one on the second mount. If cleanup is incomplete, the second mount can fail or leak memory. Always verify that destroy() is called on unmount and that no stale references persist.
Rules
- No business logic in wrappers. Data transformation, validation, and grid behavior belong in
handsontable/src/. - Cross-platform npm scripts: use Node.js
.mjshelpers instead of bash-only constructs (seescripts/prepare-types.mjsas reference).
Signals
- GitHub stars
- 22k
- Forks
- 3k
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
react-wrapper-dev- Source
- github.com/handsontable/handsontable