React Hooks To Access Browser Navigator Properties

A set of React hooks to access browser navigator properties.

Use Cases:

  • Is there an internet connection?
  • What’s the location of the user?
  • What language(s) does the user’s computer support?
  • What kind of computer does the user use?

How to use it:

1. Import the useNavigator module.

import useNavigator from "react-browser-navigator";

2. Basic usage.

function App() {
  let { networkStatus } = useNavigator();
  return (
    <div>
      {networkStatus === true ? (
        <span>We are online!</span>
      ) : (
        <span>We are offline!</span>
      )}
    </div>
  );
}

Preview:

React Hooks To Access Browser Navigator Properties

Download Details:

Author: lineceptorg

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website: https://github.com/lineceptorg/react-browser-navigator

License: MIT

Tags:

Add Comment