LauraBeatris / use-platform

πŸ“± react hook that returns an object with the user-agent platform flags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 πŸ’œπŸš€

About

πŸ“± react hook that returns an object with the user-agent platform flags

License:MIT License


Languages

Language:TypeScript 72.7%Language:JavaScript 27.3%