useDeviceDetect()
The
useDeviceDetect() hook categorizes the user's device into mobile, tablet, or desktop based on screen width media queries.Import
typescript
Usage
Current Device Type
desktop
Component.tsx
API
Arguments
customQueries– DeviceQuery[] (Optional) Array of custom query objects to override default breakpoints.
Returns
Returns a string representing the device type:
'mobile'– Screen width < 768px'tablet'– Screen width 768px - 1023px'desktop'– Screen width ≥ 1024px