{"id":26035618,"url":"https://github.com/leocardoso94/is-online-component","last_synced_at":"2025-06-23T02:05:06.707Z","repository":{"id":57277469,"uuid":"138074994","full_name":"Leocardoso94/is-online-component","owner":"Leocardoso94","description":"A simple react component that detect online and offline changes","archived":false,"fork":false,"pushed_at":"2019-07-13T12:31:28.000Z","size":251,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T02:03:26.962Z","etag":null,"topics":["detection-network","offline","online","react","react-component"],"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/Leocardoso94.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}},"created_at":"2018-06-20T19:07:56.000Z","updated_at":"2022-06-25T10:38:39.000Z","dependencies_parsed_at":"2022-09-18T15:31:18.335Z","dependency_job_id":null,"html_url":"https://github.com/Leocardoso94/is-online-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Leocardoso94/is-online-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leocardoso94%2Fis-online-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leocardoso94%2Fis-online-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leocardoso94%2Fis-online-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leocardoso94%2Fis-online-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Leocardoso94","download_url":"https://codeload.github.com/Leocardoso94/is-online-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leocardoso94%2Fis-online-component/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261397371,"owners_count":23152487,"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":["detection-network","offline","online","react","react-component"],"created_at":"2025-03-07T05:05:15.966Z","updated_at":"2025-06-23T02:05:01.691Z","avatar_url":"https://github.com/Leocardoso94.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# is-online-component\n\n![npm](https://img.shields.io/npm/dt/is-online-component.svg) [![Build Status](https://travis-ci.org/Leocardoso94/is-online-component.svg?branch=master)](https://travis-ci.org/Leocardoso94/is-online-component) [![](https://data.jsdelivr.com/v1/package/npm/is-online-component/badge)](https://www.jsdelivr.com/package/npm/is-online-component)\n\n\u003e A simple react component that detects online and offline changes\n\n\u003e Live demo [here](https://codesandbox.io/s/4ry12w6509)\n\n![](https://raw.githubusercontent.com/Leocardoso94/is-online-component/master/docs/gif.gif)\n\n## Usage\n\n```bash\n$ npm install is-online-component\n# OR\n$ yarn add is-online-component\n```\n\n```jsx\nimport React from 'react';\nimport IsOnline from 'is-online-component';\n\nconst handleChange = (isOnline) =\u003e {\n  console.log(isOnline);\n};\n\nconst App = () =\u003e (\n  \u003cdiv\u003e\n    \u003cIsOnline\n      OnlineComponent={\u003ch1\u003eonline\u003c/h1\u003e}\n      OfflineComponent={\u003ch1\u003eoffline\u003c/h1\u003e}\n      onChange={handleChange}\n    /\u003e\n  \u003c/div\u003e\n);\n\nexport default App;\n```\n\n[View demo here](https://codesandbox.io/s/4ry12w6509)\n[![Edit is-online-component](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/4ry12w6509)\n\n## Props\n\nFollowing `props` are used while initialization\n\n| Prop Name             | Type              | Description                                                                                    |\n| --------------------- | ----------------- | ---------------------------------------------------------------------------------------------- |\n| OnlineComponent `(optional)` | React.Component or String | the component that will be renderized when browser is online                                                                    |\n| OfflineComponent `(optional)`    | React.Component or String | the component that will be renderized when browser is offline                                                                        |\n| onChange `(optional)`   | Function  | function that will be called when the navigator be online or offline |\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocardoso94%2Fis-online-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleocardoso94%2Fis-online-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocardoso94%2Fis-online-component/lists"}