T8 React Pending
Concise async action state tracking for React apps
npm i @t8/react-pending
Shared or local pending state tracking with a concise API without rewrites in the app's shared state or async actions' internals.
+ let [state, withState] = usePendingState("fetch-items");
- fetchItems().then(setItems);
+ withState(fetchItems()).then(setItems);
+ if (!state.complete) return <p>Loading...</p>;