📄️ Main Component
The package provides a component that contains almost the whole logic you need to manage your toggles: Feature. This component allows to show or hide its children depending on the evaluation of a pricing feature. It has the prop expression, which reads from the JWT the evaluation of the feature. You can use the feature function to locate features by their key.
📄️ useGenericFeature
This hook is an alternative to the Feature component. It also allows to show or hide UI components depending on the evaluation of a feature. But, you may be wondering, why would you use this hook instead of Feature?
📄️ Binary Operators
The package also provides a set of binary operators that can be used to combine the evaluation of different features. The operators are:
📄️ searchNewTokenAndUpdate
The searchNewTokenAndUpdate function can be used within a response interceptor to search for the Pricing-Token header in the response and, if present, update the pricing evaluation context. The following snippet shows an example of its use within an Axios interceptor: