TwitterGitHub
Dark LogoStratik / UIbeta
useArtificialLoader

This hooks increases the value from 0 to 100 randomly in a given time. This helps us to give the loading effects and the increase is random thus making it more realistic. You can use it in various website loaders as well as loading page elements like top loading bars.

UseArtificialLoaderOptions

NameTypeDefaultDescription
durationnumber5000Total duration of the loading process in milliseconds.
initialDelaynumber0Delay before the loader starts in milliseconds.
updateCountnumber10Number of updates to the progress during the loading process.

Return Values

NameTypeDescription
isLoadingbooleanIndicates whether the loading process is currently active.
progressnumberRepresents the current progress percentage of the loader.
startLoader(options?: UseArtificialLoaderOptions) => voidFunction to start the loader with optional configuration.
stopLoader() => voidFunction to stop the loader and reset the progress.
0 %