Skip to main content

@mapcairn/react

Generic React hooks for MapCairn applications.

Checked against version 0.2.0. Install it with npm install @mapcairn/react; import from @mapcairn/react.

Hooks​

  • useLatestRef: Keeps a ref synced to the latest committed value of something an effect or event listener needs to read at the moment it actually fires, rather than at the…
  • useModelContextTool: Registers a WebMCP tool for the lifetime of the calling component, so an in-browser AI agent can discover and call it via document.modelContext.
  • useReadingDirection: The reading direction of the page, from dir on <html>, for the few components that hand a direction to a library (a slider's thumb, a group's arrow keys)…

Functions​

Types​