Rooks
Reference

Entrypoints and compatibility

Package format, React peer versions, public entrypoints, Temporal requirements, and importable public types.

Package format

Rooks is an ESM-only package with TypeScript declarations. Use import syntax and an ESM-aware bundler or runtime; no CommonJS or UMD build is published.

The package declares these React peer ranges:

  • react: ^18.0.0 || ^19.0.0
  • react-dom: ^18.0.0 || ^19.0.0

Public entrypoints

EntrypointContentsStability
rooksStable hooks, Easing, and explicitly exported typesStable public API.
rooks/experimentalExperimental hooksAPIs can change or be removed without stable-surface guarantees.
rooks/temporalTemporal hooks and their explicitly exported typesHook API is stable; the optional polyfill and BigInt requirements are isolated here.
rooks/package.jsonPackage metadataExported for tooling; it is not a hook entrypoint.

Only symbols exported by these entrypoints are public. Source-file paths and internal helper names are not supported imports.

Optional Temporal dependency

Install @js-temporal/polyfill when using rooks/temporal:

pnpm add @js-temporal/polyfill

Temporal hooks prefer a native globalThis.Temporal, otherwise load the polyfill on the client. The runtime must support BigInt. See the Temporal guide.

Explicitly importable public types

58 explicitly exported types are importable from the current package entrypoints.

rooks

  • EasingControls
  • EasingDirection
  • EasingFunction
  • EasingState
  • TextSelectionState
  • UseEasingOptions

rooks/experimental

  • CookieScopeOptions
  • DecodeFunction
  • EncodeFunction
  • JsonPrimitive
  • JsonValue
  • KeyIdentifier
  • LocationSnapshot
  • PermissionDescriptorLike
  • PermissionNameLike
  • PromiseService
  • ResponsiveMatches
  • ScrollState
  • Size
  • UseBeforeUnloadOptions
  • UseBrowserCookieStateOptions
  • UseBrowserCookieStateReturnValue
  • UseEventListenerOptions
  • UseKeyPressOptions
  • UseMediaDevicesOptions
  • UseMediaDevicesReturnValue
  • UsePermissionOptions
  • UsePermissionReturnValue
  • UseRequestOptions
  • UseRequestReturnValue
  • UseResponsiveOptions
  • UseResponsiveReturnValue
  • UseScriptOptions
  • UseScriptReturnValue
  • UseScriptStatus
  • UseScrollOptions
  • UseScrollReturnValue
  • UseSizeOptions
  • UseSizeReturnValue
  • UseVirtualListOptions
  • UseVirtualListReturnValue
  • UseWebSocketOptions
  • UseWebSocketReconnectOptions
  • UseWebSocketReturnValue
  • UseWebSocketStatus
  • ValidUseRequestOptions
  • VirtualListItem
  • VirtualListOrientation

rooks/temporal

  • TemporalAgeOptions
  • TemporalAgeResult
  • TemporalCountdownOptions
  • TemporalCountdownPrecision
  • TemporalCountdownResult
  • TemporalElapsedOptions
  • TemporalElapsedPrecision
  • TemporalNowKind
  • TemporalNowOptions
  • TemporalNowPrecision

Option and result shapes shown on hook pages are not importable unless the manifest-backed list above includes them.

rooks/experimental currently exports values only; types used internally by its hook signatures are not separate named exports.

Browser and server compatibility

Rooks does not make every browser API universally available. Browser-dependent hooks should expose or document their unsupported state, and applications must provide a fallback. Use client components in React Server Components frameworks and keep initial SSR output deterministic. See SSR and browser APIs.

On this page