I\'ve written a custom react hook which abstracts some logic for usage tracking so that it can be used everywhere:
custom hook: