Async route component for preact-router that enables lazy loading of components with loading states.
preact-async-route is a Preact component that enables lazy loading of route components in applications using preact-router. It solves the problem of large initial bundle sizes by allowing components to be loaded asynchronously only when their routes are accessed, with built-in support for loading states.
Preact developers building single-page applications with preact-router who need to optimize bundle size and improve initial load performance through code splitting.
It provides a simple, integrated solution for async routing in Preact without requiring complex configuration, offering React-like lazy loading capabilities specifically tailored for the Preact ecosystem.
Async route component for preact-router
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables lazy loading of route components via promises or callbacks, directly reducing initial bundle size as demonstrated in the usage example with dynamic imports.
Provides a `loading` prop to display user-defined components during async loads, improving perceived performance with tailored feedback.
Supports both `component` for direct JSX and `getComponent` for function-based loading, offering versatility in implementation as highlighted in the version 2.0 notes.
Designed as a drop-in replacement for standard preact-router routes, making integration straightforward without major code changes.
The README explicitly states deprecation for Preact 10+, recommending built-in Lazy components instead, reducing its relevance and long-term support for modern projects.
Only integrates with preact-router, so it's not suitable for applications using alternative routing libraries in the Preact ecosystem, creating vendor lock-in.
Focuses on loading states but lacks native error handling for failed async loads, requiring developers to implement manual error boundaries or fallbacks.