usePermission ​
browser
test coverage
Last changed: 28 days ago
TIP
This hook uses navigator.permissions browser api to provide enhanced functionality. Make sure to check for compatibility with different browsers when using this api
Hook that gives you the state of permission
typescript
import { usePermission } from '@siberiacancode/reactuse';
Usage ​
typescript
const { state, supported, query } = usePermission('microphone');
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
permissionDescriptorName | UsePermissionName | - | - The permission name |
options.enabled? | boolean | true | - Whether the permission is enabled |