Returns flags to make conditions based on the user-agent platform
๐
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