Skip to content

Instantly share code, notes, and snippets.

@francois-roget
Created May 25, 2021 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francois-roget/2675dc9597bb7692697262c257727d7e to your computer and use it in GitHub Desktop.
Save francois-roget/2675dc9597bb7692697262c257727d7e to your computer and use it in GitHub Desktop.
import {useContext} from 'react';
import PermissionContext from "./PermissionContext";
import {Permission} from "../Types";
const usePermission = (permission: Permission) => {
const {isAllowedTo} = useContext(PermissionContext);
return isAllowedTo(permission);
}
export default usePermission;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment