Enforce RBAC permissions in your application’s frontend using the Stytch React Native SDK
import { View, Button } from 'react-native'; import { useStytchIsAuthorized } from '@stytch/react-native/b2b'; const DocumentActions = () => { const { isAuthorized } = useStytchIsAuthorized('documents', 'edit'); // Check permissions both before taking actions const editDocument = () => { if (!isAuthorized) { throw new Error('You do not have permission to edit documents'); } proceedWithEdit(); }; // And to hide or disable UI elements return ( <View> <Button title="Edit Document" disabled={!isAuthorized} onPress={editDocument} /> </View> ); };