useDelay
The useDelay
hook adds an artificial delay within your server components. This is useful to debug timing issues and to design fallback UI states at suspense boundaries.
Example code
Anchor link to section titled "Example code"
The useDelay
hook is useful when testing suspense boundary fallbacks. The following is an example:
The useDelay
hook takes the following arguments:
Key | Required | Description |
---|---|---|
delay |
Yes | A unique string or the result of either useQuery or useShopQuery . |
time |
Yes | The amount of time in milliseconds to delay. |
Return value
Anchor link to section titled "Return value"The useDelay
hook returns the result of either useShopQuery
or useQuery
after the specified delay.