Licensing
What Is this?
Utilities to manage the display of components within Matchplat applications based on the licenses purchased by the user.
info
You need CronoUser
installed to use this component
CronoLicense
Install
Install CronoLicense
into your components to manage the display of components:
import { CronoLicense } from "@matchplat/crono";
Use
Test the license with the license
prop.
const Route = () => {
return (
...
<CronoLicense license="LicenseValue">
<LicensedFeature />
</CronoLicense>
);
};
useCronoLicense
Install
Import useCronoLicense
into your components to test if the user has a certain license.
This can also be useful for testing logical conditions and not just the visibility of components:
import { useCronoLicense } from "@matchplat/crono";
Use
const MyComponent = () => {
const hasLicense = useCronoLicense('LicenseValue')
//used for logical conditions
const showData = hasLicense ? 'show' : null;
//used for conditional display of components
return (
...
<ContainerComponent>
{hasLicense && <LicensedFeature />}
</ContainerComponent>
);
};