https://github.com/cosmo-frameworks/cf-react-internet-status
NPM package to check internet connection status in react
https://github.com/cosmo-frameworks/cf-react-internet-status
connectivity internet npm react status
Last synced: about 2 months ago
JSON representation
NPM package to check internet connection status in react
- Host: GitHub
- URL: https://github.com/cosmo-frameworks/cf-react-internet-status
- Owner: cosmo-frameworks
- License: mit
- Created: 2025-02-28T08:48:21.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-22T12:55:26.000Z (about 1 year ago)
- Last Synced: 2025-03-22T13:22:20.872Z (about 1 year ago)
- Topics: connectivity, internet, npm, react, status
- Language: TypeScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cf-react-internet-status
## Installation
```
npm install cf-react-internet-status
```
## Example
Import and use the **InternetStatusProvider**, then you can use the hook **useInternetStatusContext**
```typescript
import {
InternetStatusProvider,
useInternetStatusContext,
} from "cf-react-internet-status";
function App() {
const { isOnline } = useInternetStatusContext();
return (
{isOnline ? (
You're connected to the internet.
) : (
No internet connection.
)}
);
}
export default App;
```
You can also use the component **InternetStatus**
```typescript
import {
InternetStatusProvider,
InternetStatus,
} from "cf-react-internet-status";
function App() {
return (
);
}
export default App;
```