Skip to content

LauraBeatris/use-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

42 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published