Below is an updated README that starts with the basics and gradually introduces the concept of a loading token. We focus first on how Loadable works a

@tobq/loadable - npm

submited by
Style Pass
2025-01-13 05:30:06

Below is an updated README that starts with the basics and gradually introduces the concept of a loading token. We focus first on how Loadable works at a high level, then delve into the optional class-based token as a more advanced feature.

A lightweight, type-safe, and composable library for managing asynchronous data in React. Loadable provides hooks and utilities to make fetching data clean, declarative, and free from repetitive “loading” and “error” state boilerplate. It’s an alternative to manually writing useState + useEffect or using heavier data-fetching libraries.

By default, Loadable uses a single symbol loading to represent the “loading” state. If you need unique tokens for better debugging or timestamp tracking, you can opt for the class-based token:

You can store additional metadata (like startTime) in the token. Internally, the library handles both loading (symbol) and LoadingToken interchangeably.

Leave a Comment
Related Posts