{"id":21357099,"url":"https://github.com/brainhubinc/react-media-hook","last_synced_at":"2025-07-13T00:32:41.485Z","repository":{"id":42681491,"uuid":"164839536","full_name":"ilyalesik/react-media-hook","owner":"ilyalesik","description":"React Hook for Media Queries","archived":false,"fork":false,"pushed_at":"2024-03-28T18:47:57.000Z","size":2413,"stargazers_count":61,"open_issues_count":6,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T13:43:36.093Z","etag":null,"topics":["hook","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/ilyalesik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-01-09T10:16:18.000Z","updated_at":"2023-08-16T10:18:23.000Z","dependencies_parsed_at":"2023-02-05T21:31:55.805Z","dependency_job_id":"4d1d00a6-3e7e-4090-b0a6-52fcb9c517db","html_url":"https://github.com/ilyalesik/react-media-hook","commit_stats":null,"previous_names":["lessmess-agency/react-media-hook"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyalesik%2Freact-media-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyalesik%2Freact-media-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyalesik%2Freact-media-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyalesik%2Freact-media-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilyalesik","download_url":"https://codeload.github.com/ilyalesik/react-media-hook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225844822,"owners_count":17533161,"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":["hook","react"],"created_at":"2024-11-22T05:00:39.612Z","updated_at":"2025-07-13T00:32:41.472Z","avatar_url":"https://github.com/ilyalesik.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# react-media-hook\n\n[![CircleCI](https://circleci.com/gh/brainhubinc/react-media-hook.svg?style=shield)](https://circleci.com/gh/brainhubinc/react-media-hook)\n[![npm version](https://img.shields.io/npm/v/react-media-hook.svg)](https://www.npmjs.com/package/react-media-hook)\n[![npm downloads](https://img.shields.io/npm/dt/react-media-hook.svg)](https://www.npmjs.com/package/react-media-hook)\n\nReact Hook for Media Queries. \nUses [matchMedia](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) API.\n\n## Installation\n\nInstall it with yarn:\n\n```\nyarn add react-media-hook\n```\n\nOr with npm:\n\n```\nnpm i react-media-hook --save\n```\n\n## Usage\n\nPass query to *useMediaPredicate*:\n\n```javascript\nimport React from \"react\";\nimport { useMediaPredicate } from \"react-media-hook\";\n\nconst Component = () =\u003e {\n    const biggerThan400 = useMediaPredicate(\"(min-width: 400px)\");\n    \n    return \u003cdiv\u003e\n        {biggerThan400 \u0026\u0026 \u003cbutton\u003eSomeButton\u003c/button\u003e}\n    \u003c/div\u003e\n};\n\n```\n\n## API\n\n#### `useMedia(query: string)`\nReturns *undefined* (for example, in Node.js environment \nwhere *mathMedia* is not defined), or object, simular to *mathMedia(...)* result:\n```javascript\n{\n    matches: boolean,\n    media: string\n}\n```\n\n#### `useMediaPredicate(query: string)`\nReturns just *true* or *false*.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainhubinc%2Freact-media-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrainhubinc%2Freact-media-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainhubinc%2Freact-media-hook/lists"}