Piplup
@piplup/react-aclHooks

useAcl

Hook to query ACL state and run programmatic authorization checks.

Import

import { useAcl } from "@piplup/react-acl";

Basic example

function CheckAccess() {
  const { isAuthorized, loading } = useAcl();

  if (loading) return <div>Loading ACL...</div>;

  return <div>{isAuthorized({ permissions: 'read' }) ? 'Allowed' : 'Denied'}</div>;
}

Return value

Prop

Type

On this page