one-hook
Size
0.30 kb
View source

useNavigatorPermission

Query and track navigator permissions.

Installation

npm install @1hook/use-navigator-permission

Usage

import {  } from '@1hook/use-navigator-permission'

Query a permission state:

const  = ({ : 'geolocation' })

.(.)

The state will be updated in real-time as the user interacts with the browser.

API Reference

UseNavigatorPermissionOptions

The options for the useNavigatorPermission hook.

PropTypeDefault
name
NavigatorPermissionName
-

UseNavigatorPermissionReturn

The return value of the useNavigatorPermission hook.

PropTypeDefault
state
NavigatorPermissionState
-

On this page