react-device-detect

Detect device, browser, and OS type in React and conditionally render views accordingly

Library
npm
v2.2.3
2,923stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
64/100Good
Architecture62
Code Quality65
Innovation45
Learning Curve85

react-device-detect is a user-agent-sniffing library for React applications that identifies the current device type, browser, and operating system, then exposes both boolean selectors (isMobile, isBrowser, isIE) and dedicated view components (<BrowserView>, <MobileView>, <CustomView>) for conditionally rendering UI based on the detection result.

It’s explicitly scoped to scenarios where you need to know something specific about the device or browser itself — targeting a particular browser (Chrome, Safari, IE) or device category (all iPods, smart TVs, consoles) — as opposed to responsive layout concerns, which the README steers developers toward CSS media queries or matchMedia-based libraries instead. The library also exposes a testing escape hatch, letting tests override isMobile and similar flags directly.

What You Get

  • Boolean selectors like isMobile, isBrowser, isTablet, isIE, isChrome, and dozens more device/browser checks
  • Dedicated view components (BrowserView, MobileView, TabletView, CustomView) for conditional rendering by device type
  • String metadata such as browserName, osName, deviceType, and mobileModel for more granular logic
  • A withOrientationChange HOC for reacting to device orientation changes
  • A testing escape hatch that lets test suites directly override isMobile and other flags

Common Use Cases

  • Showing a “download our app” banner only to mobile visitors on a marketing site
  • Rendering a simplified UI variant specifically for smart TVs or game consoles browsing a web app
  • Displaying an unsupported-browser warning targeted at Internet Explorer users
  • Adjusting analytics or feature flags based on detected device/browser combination rather than screen size alone

Under The Hood

Architecture - The library is small and layered: src/lib/parse.js runs user-agent parsing (built on the ua-parser-js-style detection approach), src/lib/detect.js derives boolean device/browser flags from the parsed data, src/lib/buildSelectors.js and src/lib/selectors.js assemble the exported selector object, and src/components/views.js wraps those selectors into conditionally-rendering React components. src/components/hooks/ provides hook-based equivalents for consumers who prefer hooks over the view-component pattern.

Tech Stack - Plain JavaScript (no TypeScript source, though index.d.ts ships hand-written type declarations), built with Rollup per rollup.config.js, with React declared as a peer dependency so it doesn’t bundle its own copy.

Code Quality - Tests live in specs/ (get-ua-data.spec.js, types.spec.js, views.spec.js), covering both the raw detection logic and the exported view components. The library is compact (~250 lines across src/lib/), which keeps it easy to audit, though it has seen no recent commits, consistent with the README’s own framing that the library is intentionally narrow in scope and largely feature-complete for its purpose.

API Design - The dual API surface — plain booleans for quick conditionals (if (isMobile) ...) and JSX view components for declarative rendering (<MobileView>...</MobileView>) — covers both common consumption styles with no extra ceremony, and the README is explicit about when not to reach for this library (pointing to CSS media queries for pure responsive layout), which is a rare and useful bit of restraint in a library’s own documentation.

Used by 13 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

64,914

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
68
Dependency
Built with
JavaScript95%
Updated today
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
JavaScript
53%
Other

Cosmos-Server

Security · Authentication

6,121

All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.

View details
79
Repo Health
59
Technical
66
Dependency
Built with
JavaScript53%
Go43%
Updated yesterday
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
Python
64%
BSD 3

Flagsmith

Developer Tools · Devops · Ab Testing Experimentation

6,518

Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.

View details
91
Repo Health
82
Technical
65
Dependency
Built with
Python64%
TypeScript31%
Updated today
TypeScript
62%
Other

Flowise

Developer Tools · Automation · No Code Platforms

55,379

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript62%
JavaScript27%
Updated 6 days ago
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search