AutoSuspense Simplifies React Loading Fallbacks

Hello everyone, Ever noticed how React apps look amazing… until loading kicks in? That “meh” fallback UI always felt off to me. While building with React Suspense, I kept running into the same issue: every time the UI changed, I had to rewire fallbacks in multiple places. It felt fragile. Repetitive. And honestly, a waste of time. So I dug into why. The problem wasn’t Suspense itself. It was where we define fallbacks. 👉 Today: parents control fallbacks 👉 But in reality: loading belongs to the component So I built AutoSuspense. A small React DX library where: • Components declare their own fallback • No manual wiring in parents • The fallback UI is automatically composed Example: <AutoSuspense> <Profile> <Posts /> <Sidebar /> </Profile> </AutoSuspense> Each component declares its own loading: export default Suspend(Profile, <ProfileSkeleton>{children}</ProfileSkeleton>); export default Suspend(Posts, <PostsSkeleton />); export default Suspend(Sidebar, <SidebarSkeleton />); And instead of separate loaders… It builds a single fallback tree: <ProfileSkeleton> <PostsSkeleton /> <SidebarSkeleton /> </ProfileSkeleton> No rewiring. No duplication. No structure headaches. Just: Components declare loading => AutoSuspense builds the tree Also supports fallback mapping for scale: <AutoSuspense fallbacks={{ profile: <Skeleton /> }}> <Child /> </AutoSuspense> export default Suspend(Component, "profile"); If you're curious, check it out: 🔗 https://lnkd.in/ggRmu_kE Still exploring where this pattern can go. Would love feedback. 👀 #react #javascript #frontend #opensource #webdev

  • graphical user interface

can you share some gist file, looks amazing somehow I need more clarity in terms of the problem you aree trying to solve or it cannot be implemented by maintaing a loading.tsx file in each route for nextjs?

Like
Reply

Can you share a video of you actually using it?

Like
Reply

Looks intresting bro 🙌

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories