Skip to content

Files

Latest commit

334a5a5 Β· Jul 10, 2019

History

History
19 lines (14 loc) Β· 306 Bytes

usePermission.md

File metadata and controls

19 lines (14 loc) Β· 306 Bytes

usePermission

React side-effect hook to query permission status of browser APIs.

Usage

import {usePermission} from 'react-use';

const Demo = () => {
  const state = usePermission({ name: 'microphone' });

  return (
    <pre>
      {JSON.stringify(state, null, 2)}
    </pre>
  );
};