Skip to content

Instantly share code, notes, and snippets.

@mindplay-dk
Created March 30, 2025 07:32
Show Gist options
  • Save mindplay-dk/24b3e29bac050775216a5c4ba4d65dcc to your computer and use it in GitHub Desktop.
Save mindplay-dk/24b3e29bac050775216a5c4ba4d65dcc to your computer and use it in GitHub Desktop.
DeepSeek really doesn't like React

between the most popular frontend frameworks (React, Svelte and Solid in particular) what are the features a modern frontend framework must have to be considered a serious option? focus on frontend frameworks with fine grained reactivity. ignore features like server side rendering and server components and focus on frontend features. identify features and requirements that are handled differently in each framework and focus on the problems they solve.

To be considered a serious modern frontend framework with fine-grained reactivity, the following features and capabilities are essential. These features address core challenges like efficient DOM updates, state synchronization, and developer ergonomics. Below is a breakdown of these requirements and how React, Svelte, and Solid handle them differently:


1. Fine-Grained Reactivity System

A framework must track dependencies at the most granular level (e.g., individual variables or DOM nodes) to update only what changes, avoiding unnecessary work.

  • Svelte: Compiles components to surgically update the DOM using reactive declarations ($:). The compiler analyzes dependencies and generates optimized, imperative code.
  • Solid: Uses explicit signals (via createSignal) and reactive primitives to track dependencies. Only components/elements subscribed to a signal update.
  • React: Relies on coarse-grained re-renders of entire components (via virtual DOM diffing). Requires manual optimizations (e.g., memo, useMemo) to approximate fine-grained updates.

2. Reactive Primitives

First-class tools to declare and manage reactive state, derived values, and side effects, with minimal boilerplate.

  • Svelte: Reactive variables (automatically tracked with $:), and stores for cross-component state.
  • Solid: Signals (createSignal), derived signals (createMemo), and stores (createStore). Explicit but lightweight.
  • React: useState, useMemo, and useEffect require manual dependency arrays, leading to potential over-rendering.

3. Direct DOM Updates

Avoid the overhead of a virtual DOM by directly modifying the DOM when state changes.

  • Svelte: Compiler-generated DOM updates; no runtime diffing.
  • Solid: Binds signals directly to DOM nodes, updating them in place.
  • React: Uses virtual DOM reconciliation, which introduces runtime overhead but simplifies declarative programming.

4. Component Scoping

Encapsulate styles, state, and behavior to prevent leaks and simplify composition.

  • Svelte: Scoped CSS by default (styles are component-local).
  • Solid/React: Rely on CSS-in-JS libraries or conventions (e.g., CSS Modules) for scoping.

5. Declarative Syntax

Express UI based on state without imperative DOM manipulation.

  • Svelte: HTML-like templates with bindings (e.g., bind:value).
  • Solid/React: Use JSX with reactive control flow (e.g., Solid’s <Show> component, React’s conditional rendering).

6. Automatic Dependency Tracking

Eliminate manual dependency management for effects and derived state.

  • Svelte: Automatically tracks dependencies in reactive blocks ($: doubled = count * 2).
  • Solid: Automatically tracks signal dependencies in effects (createEffect).
  • React: Requires explicit dependency arrays in hooks (e.g., useEffect(() => {}, [deps])), risking stale closures or missed updates.

7. Efficient Derived State

Compute values reactively without redundant calculations.

  • Svelte: Reactive declarations ($: derived = ...) recompute only when dependencies change.
  • Solid: createMemo caches derived values and updates only when inputs change.
  • React: useMemo or manual memoization required, often leading to fragmented logic.

8. Effect Management

Handle side effects (e.g., data fetching, subscriptions) in response to state changes.

  • Svelte: Reactive statements ($: { fetchData() }) auto-run when dependencies change.
  • Solid: createEffect automatically tracks signal dependencies and runs when they change.
  • React: useEffect requires manual dependency arrays, complicating synchronization.

9. Minimal Boilerplate

Reduce setup code for reactivity and state management.

  • Svelte: Near-zero boilerplate (reactive variables declared inline).
  • Solid: Lightweight signals but requires explicit subscription in JSX (e.g., {signal()}).
  • React: Verbose due to hooks, memo, and dependency arrays.

10. Performance Optimizations

Prioritize runtime efficiency for complex UIs.

  • Svelte: Compile-time optimizations eliminate runtime overhead.
  • Solid: Runtime fine-grained reactivity with near-instant updates.
  • React: Virtual DOM and concurrent rendering (e.g., time-slicing) mitigate performance cliffs.

Key Differentiators and Tradeoffs

Feature Svelte Solid React
Reactivity Model Compiler-driven, DOM-bound Explicit signals Coarse-grained, VDOM-based
Boilerplate Minimal (magic under the hood) Explicit but concise High (hooks, memoization)
Performance Optimal (no runtime overhead) Near-optimal (runtime signals) Good (with manual optimizations)
Learning Curve Low (HTML-centric) Moderate (JSX + signals) Moderate (hooks, ecosystem)
Styling Built-in scoped CSS Requires external solutions Requires external solutions

Conclusion

A modern framework with fine-grained reactivity must prioritize direct DOM updates, automatic dependency tracking, and minimal boilerplate. Svelte and Solid excel here, while React compensates with ecosystem strength and concurrent rendering. The choice hinges on whether the developer prefers a compiler-driven approach (Svelte), explicit signals (Solid), or prioritizes ecosystem maturity (React).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment