use-os

React Package to show OS type

Usage no npm install needed!

<script type="module">
  import useOs from 'https://cdn.skypack.dev/use-os';
</script>

README

:package: use-os

:package: use-os

Parses browser user-agent strings for React

Did you like the project? Please, considerate being a supporter and receive exclusive gifts!

Installation

Clone this repository: git clone https://github.com/hebertcisco/use-os

Open the directory and install the dependencies

cd use-os
npm install

Using

import useOs from "use-os";

In react component:

export default function HomePage() {
  const os = useOs();

  return (
    <div>
      {os === "windows" ? (
        <>
          <b>Windows</b> (.exe)
        </>
      ) : (
        <></>
      )}
    </div>
  );
}