UNPKG

react-render-wave

Version:

A compact React hook and component for progressive rendering of large datasets with optional scroll virtualization.

103 lines (62 loc) โ€ข 3.12 kB
![ShowCase](https://dev-intj.github.io/images/RenderWave/showcase.png) # ๐ŸŒŠ React Render Wave **A compact React hook + component for effortlessly rendering large datasets in waves.** React Render Wave helps you break rendering into small, timed batches to keep your UI smooth and responsiveโ€”especially when working with large lists or data-heavy UIs. By leveraging Rust for high-performance data processing and WebAssembly (WASM) for near-native speed in the browser, this solution ensures that rendering is both fast and memory-safe. --- ## โœจ Features - โœ… Lightweight and customizable - ๐ŸŒŠ Progressive wave-based rendering (batchSize) - ๐Ÿง  Virtual scroll with overscan support - โŒจ๏ธ Keyboard navigation - ๐Ÿฆด Skeleton loading support - ๐Ÿงฒ Snap-to-batch scroll alignment - โš›๏ธ Built with modern React and TypeScript - ๐Ÿš€ Rust-powered data handling for ultra-fast performance and memory safety (via WebAssembly) ## ๐Ÿš€ Performance Benefits of Rust To ensure smooth UI rendering even when handling massive datasets, React Render Wave leverages Rust, compiled to WebAssembly (WASM). Rust's efficiency in managing memory and its ability to handle large data structures with high concurrency make it the perfect choice for accelerating data processing in the browser. Key Benefits: Blazing Fast Data Handling: Rustโ€™s low-level control over memory and concurrency allows us to process data more efficiently, resulting in faster rendering times for large datasets. Memory Safety: By using Rust, we avoid common bugs such as data races or memory leaks, ensuring a reliable user experience. WebAssembly Integration: Rust is compiled into WebAssembly (WASM) for near-native performance directly in the browser, without requiring additional backend resources. --- ## ๐Ÿ“ฆ Installation ```bash npm install react-render-wave # or yarn add react-render-wave ``` ## ๐Ÿงช Basic Usage ```jsx import { RenderWave } from "react-render-wave"; const items = Array.from({ length: 1000 }, (_, i) => `Item ${i}`); <RenderWave items={items} batchSize={20} interval={60} renderItem={(item, index) => <div key={index}>{item}</div>} />; ``` ## ๐Ÿ” Virtual Scroll Usage ```jsx import { VirtualRenderWave } from "react-render-wave"; <VirtualRenderWave items={items} itemHeight={40} containerHeight={400} overscan={5} keyboardNavigation renderItem={(item, index) => <div>{item}</div>} />; ``` ## ๐Ÿ“˜ Documentation ๐Ÿ‘‰ View full demos and interactive props in [storybook](https://astonishing-cuchufli-c17417.netlify.app) ## ๐Ÿงฉ Roadmap - โœ… Progressive rendering - โœ… Virtual scrolling - โœ… Keyboard support - โœ… Snap-to-batch scroll - โœ… Focus/scroll-to-element API - โœ… Sticky headers - โœ… Rust/Wasm acceleration (experimental) โ€“ leveraging Rust and WebAssembly for faster and safer data handling ## ๐ŸŒ Contribute I welcome contributions! If youโ€™d like to help improve React Render Wave, feel free to fork the repo and submit a pull request.