Examples
Dynamic Intents
Learn how to modify the intents on UI2 dynamically
While UI2 was originally designed to have a constant set of intents, you can also achieve dynamic intents through a few changes to the standard method of building the Intent Interface.
Example
This approach likely makes the most sense with the React Hook, but here we show how you can theoretically do it with the Stateless API. It directly applies to the React useUI2
hook as well.
Here, we remove the sum
intent and then add the square
intent. Note that addIntent
can be destructured from createUI2
or directly chained onto the end. This is due to the fact how createUI2
returns an IntentCreator
and all of its methods also return IntentCreator
s.