Fine-Grained Reactive UI Library
"Instant Precision: Reactivity Redefined with Compile-Time Intelligence"
Reflex redefines UI development with a focus on reactivity, efficiency, and extensibility. By leveraging a reactive graph and a Rust-based compiler, Reflex eliminates the overhead of traditional Virtual DOM approaches, delivering predictable performance and a streamlined developer experience.
Key attributes include:
- R — Reactive: Instantaneous, signal-driven updates with no unnecessary re-renders.
- E — Efficient: Optimized through compile-time graph analysis and direct DOM mutations.
- F — Fine-Grained: Precise updates target only changed elements, minimizing computational cost.
- L — Lightweight: ~5–7 KB minified bundle, ideal for mobile and low-bandwidth environments.
- E — Extensible: Plugin-driven reactive graph supports custom nodes and edges.
- X — eXecutable: Direct control over effects and updates, bypassing intermediaries.
Unlike Virtual DOM libraries like React, which rely on diffing and component re-renders, Reflex models the UI as a dynamic reactive graph. A Rust-based compiler analyzes dependencies at build time, reducing runtime overhead and enabling near-native performance. This approach ensures scalability for complex applications while maintaining simplicity for developers.
Reflex prioritizes:
- Signals Over Re-Renders: Updates are confined to actual changes using
signal
andcomputed
. - Direct DOM Access: Eliminates diffing, interacting only with affected nodes.
- Adaptive Graph Topology: Components form a reactive graph, optimized at compile time.
- Familiar JSX API: Seamless integration with JSX, compiled to efficient JavaScript.
-
Fine-Grained Reactivity
signal
andcomputed
primitives enable precise, dependency-tracked updates. -
Direct DOM Operations
Bypasses Virtual DOM, performing in-place mutations for maximum efficiency. -
Reactive Effects
Replaces lifecycle hooks with automated effects, triggered by dependency changes. -
Streaming SSR + Islands Architecture
Hydrates only critical components, supporting resumable server-side rendering. -
Graph-Level Extensibility
Plugins extend the reactive graph, enabling custom nodes, edges, and behaviors. -
Compile-Time Optimization
A Rust-based compiler analyzes the reactive graph, minimizing runtime computations using graph algebra.
Capability | Virtual DOM (e.g., React) | Reflex |
---|---|---|
State | Hooks/reducers | signal , computed |
Updates | Component re-renders | Direct node updates |
DOM Rendering | Virtual DOM diffing | Direct DOM calls |
Reactivity | Render-driven | Fine-grained signals |
SSR | Traditional APIs | Streaming + Resumption + Islands |
Lifecycle | Lifecycle hooks | Reactive effects |
Extensibility | Hooks/HOCs | Graph-level plugins |
Bundle Size | ~40–45 KB (minified) | ~5–7 KB (minified) |
Optimization | Runtime diffing | Compile-time graph analysis |
"Reflex" reflects the library’s core philosophy: immediate, instinctual responses to state changes. Local updates propagate precisely through the reactive graph, optimized at compile time for responsiveness and simplicity. The name is independent of any external affiliations.
Reflex leverages a Rust-based compiler to analyze the reactive graph at build time, using graph algebra to optimize dependencies and minimize runtime computations. Key benefits include:
- Static Dependency Analysis: Eliminates runtime dependency tracking, reducing overhead.
- Graph Optimization: Applies topological sorting, dead code elimination, and edge merging.
- Cycle Detection: Identifies and resolves cyclic dependencies at compile time.
- WebAssembly Integration: Critical operations compiled to WebAssembly for near-native performance.
This approach makes Reflex up to 2–3x faster than Virtual DOM libraries in dynamic UI scenarios, with a significantly smaller bundle size.
Forget re-renders and complexity. Reflex synchronizes data instantly with any environment, from browsers to mobile apps, using a minimal, high-performance core. It’s not just another framework—it’s a reactive foundation for modern UI development.
Installation:
npm install @reflex/core
Quick Example (JavaScript):
import { signal, computed, effect } from "@reflex/core";
const count = signal(0);
const double = computed(() => count.value * 2);
effect(() => {
const el = document.getElementById("app");
if (el) el.textContent = `Count: ${count.value}, Double: ${double.value}`;
});
count.value++; // Updates DOM instantly
JSX Example:
import { signal, computed, render } from "@reflex/core";
function Counter() {
const count = signal(0);
const double = computed(() => count.value * 2);
return (
<div>
<p>Count: {count.value}</p>
<p>Double: {double.value}</p>
<button onClick={() => count.value++}>Increment</button>
</div>
);
}
render(<Counter />, document.getElementById("app"));
The Rust compiler transforms JSX into optimized JavaScript, wiring signals and effects into the reactive graph for direct DOM updates.
- Documentation: reflex.dev/docs (coming soon)
- GitHub: github.com/reflex-ui/core
- Community: Join discussions on X or Discord
MIT License © 2025 Andrii Volynets
- All product names, logos, and brands are property of their respective owners.
- “React” and related marks are trademarks of Meta Platforms, Inc. Reflex is not affiliated with or endorsed by Meta or any other vendor.
- Package name and branding are subject to change.