A React component that can be wrapped around one or more components to
determine whether they should be rendered based on the specified policy
action, user, and record.
Parameters
props: PropsWithChildren<WhenProps>
The props passed to the component to determine whether it
should be rendered. These must include the policy action name, and optionally
the policy instance, user, and record.
Returns ReactNode
The child component(s) that would be rendered if the policy action
is permitted. Returns null if the policy action is not permitted.
A React component that can be wrapped around one or more components to determine whether they should be rendered based on the specified policy action, user, and record.