Experimental Hooks
useSuspenseNavigatorUserAgentData
About
⚠️ Experimental Hook: This hook may be removed or significantly changed in any release without notice.
A Suspense-enabled hook for getting high entropy values from the Navigator User Agent Data API. This hook suspends while the API is fetching data and must be wrapped in a Suspense boundary. It provides access to detailed browser and platform information that requires user permission.
Examples
Basic Usage with All Hints
Requesting Specific Hints
With Error Boundary
Arguments
Argument | Type | Description | Default |
---|---|---|---|
hints | string[] | Array of high entropy hints to request. See available hints below. | All hints |
Available High Entropy Hints
Hint | Type | Description |
---|---|---|
architecture | string | The underlying platform architecture (e.g., "x64", "arm") |
bitness | string | The architecture bitness (e.g., "32", "64") |
formFactors | string[] | The form factors of the device (e.g., ["Desktop"], ["Mobile", "Tablet"]) |
fullVersionList | object[] | Array of browser brands and their full versions |
model | string | The device model name (mainly for mobile devices) |
platformVersion | string | The platform version (e.g., "10.0" for Windows) |
uaFullVersion | string | Full browser version (deprecated, use fullVersionList instead) |
wow64 | boolean | Whether the browser is running in 32-bit mode on 64-bit Windows |
Returns
Returns an object containing the requested high entropy values.
Return Value Properties
The returned object may contain any of the following properties based on the hints requested:
Property | Type | Description |
---|---|---|
architecture | string | The underlying platform architecture |
bitness | string | The architecture bitness |
formFactors | string[] | Array of device form factors |
fullVersionList | object[] | Array of objects with brand and version properties |
model | string | The device model name |
platformVersion | string | The platform version |
uaFullVersion | string | Full browser version (deprecated) |
wow64 | boolean | Whether running in WoW64 mode |
Browser Support
This hook uses the Navigator User Agent Data API, which is currently only supported in:
- Chrome 90+
- Edge 90+
- Opera 76+
The hook will throw an error in unsupported browsers.
Important Notes
- Experimental Status: This hook is experimental and may change or be removed in future versions
- Privacy: High entropy values may require user permission and can be used for fingerprinting
- Suspense Required: This hook must be wrapped in a React Suspense boundary
- Error Boundaries: Consider using error boundaries to handle unsupported browsers
- Caching: Results are cached to prevent duplicate API calls with the same hints