Hide function in showAlert hook does not seem to exist

I can see from the docs here that I should be able to get a second function out of the useAlert hook like so:
const {show, hide} = useAlert(...)
However when I try and use this I get an error saying the function does not exist:
TypeError: hide is not a function
Perhaps I am getting the hide function in the wrong way?
The reason I want to trigger the hide manually is because the app is showing a critical error (which does not auto hide and I can’t seem to get it to auto hide). So I need to set the error to hide when the user dismisses conflicts in another part of the app.

Any help much appreciated!
Thanks,
Pete

Hey @plinnegan

I think the hide function on the useAlerts hook was exposed the on version 3.1.0 of the @dhis2/app-runtime (see here). Are you perhaps using a version older than that?

3 Likes

You are right! Saved the day again thanks Gift! (We are on version 2.9.2)

3 Likes