Skip to main content
Version: v3.6.0

@rooks/use-online

Online status hook for React.


Build Status

Installation

npm install --save @rooks/use-online

Importing the hook

import useOnline from "@rooks/use-online";

Usage

function Demo() {
const isOnline = useOnline();
return <p>Online status - {isOnline.toString()}</p>;
}

render(<Demo />);

Return value

Offline status (boolean) is returned.