use-oneline-status hook
Get Started
Description
This hook is used to get the online status of the user. It returns an enum value indicating the user's online status. The possible values are 'ONLINE' and 'OFFLINE'.
install
You can install the package via npm or yarn:
npm install -d @melmerrouni/custom-hooks
Example
You just need to import useOnlineStatus
from @melmerrouni/custom-hooks
:
demo.tsx
import {useOnlineStatus} from '@melmerrouni/custom-hooks';
const Target = () => {
const {status} = useOnlineStatus();
return (
<>
<div className={status} data-testid="target">{status}</div>
</>
)
};
Demo
Last updated on April 11, 2024