Configure your existing IoT Hub
In order to use the following hooks, you need to perform additional setup steps:
In both cases, the IoT Hub routing must be configured.
For 'Device Twin Changed Events', which are required for the useDeviceTwin hook, a routing rule must be added as follows:

If you want to use Azure CLI, you can accomplish the same in the following way:
AZ CLI
az iot hub route create \
--route-name ux4iot-twinchanges \
--hub-name IOT_HUB_NAME \
--resource-group RESOURCE_GROUP_OF_IOT_HUB \
--condition true \
--endpoint events \
--source twinchangeevents
For 'Connection State Events', which are required for the useConnectionState hook, a routing rule must be added as follows:

If you want to use Azure CLI, you can accomplish the same in the following way:
AZ CLI
az iot hub route create \
--route-name ux4iot-connectionevents \
--hub-name IOT_HUB_NAME\
--resource-group RESOURCE_GROUP_OF_IOT_HUB \
--condition true \
--endpoint events \
--source deviceconnectionstateevents