{"id":14971549,"url":"https://github.com/alejandrorm-dev/react-media-queries","last_synced_at":"2025-11-20T07:01:18.795Z","repository":{"id":255436383,"uuid":"849625662","full_name":"AlejandroRM-DEV/react-media-queries","owner":"AlejandroRM-DEV","description":"react-media-queries is a React hooks library that provides useful custom hooks for responsive design and media queries.","archived":false,"fork":false,"pushed_at":"2024-09-24T04:24:47.000Z","size":493,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T21:11:28.794Z","etag":null,"topics":["react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlejandroRM-DEV.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-30T00:02:44.000Z","updated_at":"2024-08-31T00:23:46.000Z","dependencies_parsed_at":"2024-10-11T05:51:02.925Z","dependency_job_id":null,"html_url":"https://github.com/AlejandroRM-DEV/react-media-queries","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":0.3529411764705882,"last_synced_commit":"42c07e9b4b829ac5dc0303be5ffc4d255a9d6cd7"},"previous_names":["alejandrorm-dev/mx-hooks","alejandrorm-dev/react-media-queries"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroRM-DEV%2Freact-media-queries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroRM-DEV%2Freact-media-queries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroRM-DEV%2Freact-media-queries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroRM-DEV%2Freact-media-queries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlejandroRM-DEV","download_url":"https://codeload.github.com/AlejandroRM-DEV/react-media-queries/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238366707,"owners_count":19460170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react"],"created_at":"2024-09-24T13:45:21.924Z","updated_at":"2025-11-20T07:01:18.789Z","avatar_url":"https://github.com/AlejandroRM-DEV.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Media Queries\n\n![Build Status](https://img.shields.io/github/actions/workflow/status/AlejandroRM-DEV/react-media-queries/release.yml?branch=main)\n![npm version](https://img.shields.io/npm/v/@alejandrorm-dev/react-media-queries)\n![npm](https://img.shields.io/npm/dw/@alejandrorm-dev/react-media-queries)\n![License](https://img.shields.io/badge/license-MIT-blue)\n![GitHub issues](https://img.shields.io/github/issues/AlejandroRM-DEV/react-media-queries)\n![GitHub forks](https://img.shields.io/github/forks/AlejandroRM-DEV/react-media-queries)\n![GitHub stars](https://img.shields.io/github/stars/AlejandroRM-DEV/react-media-queries)\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n\nA lightweight, performant React hooks library for responsive design and media query management. Built with TypeScript and optimized for modern React applications, including SSR support.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Demo](#demo)\n- [Usage](#usage)\n- [API Reference](#api-reference)\n- [SSR Support](#ssr-support)\n- [License](#license)\n- [Contributing](#contributing)\n- [Contributors](#contributors-)\n\n## Features\n\n- 🚀 **Performant**: Uses `useSyncExternalStore` for optimal performance and React 18+ compatibility\n- 🔄 **SSR Compatible**: Handles server-side rendering gracefully\n- 🎯 **TypeScript**: Full TypeScript support with type definitions\n- 🪝 **Hooks-Based**: Modern React hooks API\n- ⚡ **Efficient**: Shared stores prevent duplicate media query listeners\n\n## Installation\n\n```bash\nnpm install @alejandrorm-dev/react-media-queries\n```\n\n## Demo\n\nhttps://github.com/user-attachments/assets/dd7719a8-a3bd-4da5-93c2-126bdfc8ceb7\n\n## Usage\n\n```typescript\nimport { useMediaQuery } from \"@alejandrorm-dev/react-media-queries\";\n\nfunction ResponsiveComponent() {\n\tconst isLargeScreen = useMediaQuery(\"(min-width: 1200px)\");\n\n\treturn (\n\t\t\u003cdiv\u003e{isLargeScreen ? \"Large screen layout\" : \"Small screen layout\"}\u003c/div\u003e\n\t);\n}\n```\n\n## API Reference\n\n### `useMediaQuery(query: string): boolean`\n\nEvaluates a single CSS media query and returns its current match state.\n\n**Parameters:**\n\n- `query` (string): The CSS media query string to evaluate (e.g., `\"(min-width: 768px)\"`)\n\n**Returns:** `boolean` - `true` if the media query matches, `false` otherwise. Returns `false` during SSR.\n\n**Example:**\n\n```typescript\nconst isTablet = useMediaQuery(\"(min-width: 768px) and (max-width: 1024px)\");\n```\n\n## SSR Support\n\nThe hook is designed to work seamlessly in server-side rendering environments. During SSR, `useMediaQuery` returns `false`. On the client, the value updates to reflect the actual media query state.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/AlejandroRM-DEV\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/8054357?v=4?s=100\" width=\"100px;\" alt=\"Alejandro Ramírez Muñoz\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlejandro Ramírez Muñoz\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/AlejandroRM-DEV/react-media-queries/commits?author=AlejandroRM-DEV\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/AlejandroRM-DEV/react-media-queries/commits?author=AlejandroRM-DEV\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandrorm-dev%2Freact-media-queries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejandrorm-dev%2Freact-media-queries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandrorm-dev%2Freact-media-queries/lists"}