Function DelayedFallback

The DelayedFallback component conditionally renders its children or a fallback component based on the isReadyToRender prop. It waits for a specified delay (fallbackDelay) before rendering the fallback component.

If the duration of fetching data is shorter than the fallbackDelay value (default: 200ms), the content is displayed without rendering the fallback. This can make it appear to the user as if the content is displayed instantly.

// Basic usage
<DelayedFallback isReadyToRender={isContentLoaded} fallback={<div>Loading...</div>}>
<div>Content is ready!</div>
</DelayedFallback>

// Custom delay
<DelayedFallback isReadyToRender={isContentLoaded} fallback={<div>Loading...</div>} fallbackDelay={500}>
<div>Content is ready!</div>
</DelayedFallback>