Skip to content

Repository files navigation

decentraland-hooks

Decentraland Cover

A collection of React hooks commonly used in Decentraland projects.

Installation

npm install @dcl/hooks

Peer Dependencies

  • react >= 18.0.0
  • decentraland-crypto-fetch >= 2.0.0 (only needed for useNotifications). Version 3 signs the ADR-44 payload with the metadata bytes bound into the signature and requires Node >= 22; version 2 does neither. npm installs the highest match, so pin the major your app targets if that matters to you.

Available Hooks

Hook Description Docs
useAsyncState Async state management with auto-reload on dependency changes docs
useAsyncMemo Alias for useAsyncState docs
useAsyncEffect Async version of useEffect with error tracking docs
useAsyncTask Single imperative async task with loading state docs
useAsyncTasks Multiple concurrent async tasks managed by ID docs
usePatchState Partial state updates for complex objects docs
useInfiniteScroll Infinite scroll with debounce and threshold docs
useAdvancedUserAgentData Browser, OS, CPU, and device detection docs
useAnalytics Segment analytics tracking (requires AnalyticsProvider) docs
usePageTracking Page view tracking (requires AnalyticsProvider) docs
useTranslation i18n with ICU message syntax via @formatjs/intl docs
useNotifications Decentraland notification polling and modal state docs

Providers

Provider Description Docs
AnalyticsProvider Segment analytics context docs
TranslationProvider i18n context for useTranslation docs

Utilities

Export Description Docs
getStorageItem / setStorageItem / removeStorageItem Typed localStorage helpers with JSON serialization docs
createNotificationsClient Decentraland notifications API client docs

Documentation

  • docs/ -- Detailed per-hook documentation with examples
  • AGENTS.md -- Compact API reference for LLM/AI consumption
  • docs/contributing.md -- Contribution guide and internal patterns

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages