1.0.0 • Published 3 months ago

react-use-platform v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

React use platform npm npm type definitions

React hook to detect client platform.

See it in action at https://filipchalupa.cz/react-use-platform/.

Use this hook to e.g. offer users to download an app from a platform specific store like Google Play, Apple App Store, Microsoft Store.

Installation

npm install react-use-platform

Usage

import { usePlatform } from 'react-use-platform'

const App = () => {
	const platform = usePlatform()

	return <p>Your platform is {platform}.</p>
}

Without hook

import { getPlatform } from 'react-use-platform'

console.log(`Your platform is ${getPlatform()}.`)

Possible values

type Platform = 'android' | 'ios' | 'windows' | 'mac' | 'unknown'
1.0.0

3 months ago

0.2.0

9 months ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago