/use-platform

📱 react hook that returns an object with the user-agent platform flags

Primary LanguageTypeScriptMIT LicenseMIT

Returns flags to make conditions based on the user-agent platform

Author Languages Stars Forks Contributors

📌 Table of Contents

👷 Installation

via npm

npm install use-platform

via yarn

yarn add use-platform

✈️ Usage

Make conditions based on the user-agent platform

const SignInScreen: React.FC = () => {
  const { isMac, isIOS } = usePlatform();

  const shouldShowSignInWithApple = isMac || isIOS;

  return (
    <div>
      {
        shouldShowSignInWithApple && (
          <button type="button">
            Sign in with Apple
          </button>
        )
      }
    </button>
  )
}

🐛 Issues

Feel free to file a new issue with a respective title and description on the use-platform repository. If you already found a solution to your problem, I would love to review your pull request! Have a look at our contribution guidelines to find out about the coding standards.

🎉 Contributing

Check out the contributing page to see the best places to file issues, start discussions and begin contributing.

📕 License

Released in 2020 This package is under the MIT license.

Made with love by Laura Beatris 💜🚀