React
schematic-react
is a client-side React library for Schematic which provides hooks to track events, check flags, and more. schematic-react
provides the same capabilities as schematic-js, for React apps.
Install
Usage
SchematicProvider
You can use the SchematicProvider
to wrap your application and provide the Schematic instance to all components:
Setting context
To set the user context for events and flag checks, you can use the identify
function provided by the useSchematicEvents
hook:
Tracking usage
Once you’ve set the context with identify
, you can track events:
Checking flags
To check a flag, you can use the useSchematicFlag
hook:
Checking entitlements
You can check entitlements (i.e., company access to a feature) using a flag check as well, and using the useSchematicEntitlement
hook you can get additional data to render various feature states:
License
MIT
Support
Need help? Please open a GitHub issue or reach out to support@schematichq.com and we’ll be happy to assist.