@dcl/hooks
v1.4.0
Published

Readme
decentraland-hooks

A collection of React hooks commonly used in Decentraland projects.
Installation
npm install @dcl/hooksPeer Dependencies
react>= 18.0.0decentraland-crypto-fetch>= 2.0.1 (only needed foruseNotifications)
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.
