web-api-hooks
Version:
Essential set of React Hooks for convenient Web API consumption.
16 lines (15 loc) • 482 B
TypeScript
/**
* Tracks loading state of the page.
*
* @returns Readiness of the [`document`](https://developer.mozilla.org/docs/Web/API/Document), which is `'loading'` by default.
*
* @example
* function Component() {
* const documentReadiness = useDocumentReadiness();
* if (documentReadiness === 'interactive') {
* // You may interact with any element of the document from now
* }
* // ...
* }
*/
export default function useDocumentReadiness(): DocumentReadyState;