{"id":21291674,"url":"https://github.com/komlev/tiny-use-media-esm","last_synced_at":"2025-10-29T14:06:18.539Z","repository":{"id":57702554,"uuid":"502077834","full_name":"komlev/tiny-use-media-esm","owner":"komlev","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-10T15:05:05.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-24T17:07:18.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/komlev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-10T14:42:05.000Z","updated_at":"2022-06-10T14:45:37.000Z","dependencies_parsed_at":"2022-09-26T21:11:20.913Z","dependency_job_id":null,"html_url":"https://github.com/komlev/tiny-use-media-esm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media-esm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media-esm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media-esm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media-esm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komlev","download_url":"https://codeload.github.com/komlev/tiny-use-media-esm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243760553,"owners_count":20343650,"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":[],"created_at":"2024-11-21T13:39:01.908Z","updated_at":"2025-10-29T14:06:18.515Z","avatar_url":"https://github.com/komlev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tiny-use-media-esm\n\nSmall (0.5 Kb) react hook for getting media breakpoints state info in runtime\n\n## Usage\n\n```\nnpm i tiny-use-media-esm --save\n```\n\nAdn in your react code\n\n```js\nimport { useMedia } from \"tiny-use-media-esm\";\n\n// ...\n\nconst { current, md, lg } = useMedia({\n  sm: 640,\n  md: 768,\n  lg: 1024,\n  xl: 1280,\n});\n\nconsole.log({ current, md, lg });\n/*\n  if you current screen size is 900px\n  it will print:\n  { current: 'md', md: true, lg: false }\n*/\n```\n\n## API\n\nInput:\n\n```js\n// object with breakpoints names/values\nconst breakpointsConfig = {\n  mobile: 320, // min-width for mobile\n  tablet: 640, // min-width for tablet\n  desktop: 1024, // min-width for desktop\n};\n\nuseMedia(breakpointsConfig);\n```\n\nOutput:\n\n```js\nconst output = useMedia(breakpointsConfig);\n```\n\nOutput contains \"**current**\" field which corresponds to a current breakpoint.\n\nIt also contains boolean values for each provided breakpoint.\n\nE.g. output for screen size of 900px\n\n```js\n{\n    current: \"tablet\",\n    mobile: true,\n    tablet: true,\n    desktop: false\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Ftiny-use-media-esm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomlev%2Ftiny-use-media-esm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Ftiny-use-media-esm/lists"}