Svelte 5 with Runes: what really changes for devs used to React



Svelte 5 with Runes redefines the framework’s reactivity and concretely changes the reference points for developers used to React, especially regarding state management, effects, and reusable code.


discover what's new in svelte 5 with runes and what really changes for developers used to react, for a smooth and effective transition.

For a front-end team coming from React, the first impression can be surprising: Svelte keeps its promise of simplicity, but abandons part of its historical “magic” in favor of more explicit reactivity. Runes make intentions more visible in the code, with concepts that recall hooks without copying them entirely.

So the real question is not whether Svelte becomes React. Rather, it is about understanding how Svelte 5 with Runes brings the developer experience closer to familiar patterns, while preserving its compiled model, without a virtual DOM and performance-oriented.

What Svelte 5 with Runes changes for a React developer

In previous versions, Svelte made it possible to create reactive state with a simple let declaration. This approach was elegant, but it relied on conventions specific to the compiler, sometimes less obvious as soon as the code moved out of a component.

With Svelte 5 with Runes, reactivity becomes more explicit. The main primitives, such as $state, $derived and $effect, clearly indicate the role of each piece of logic, which makes reading easier for developers already used to useState, useMemo, or useEffect.

The difference remains important: React re-executes the component during a state change, whereas Svelte relies on a model closer to signals. This choice improves the granularity of updates, but also requires a better understanding of what remains reactive and what no longer is.

Why $state replaces reactive let in Svelte 5

$state is the new way to declare mutable state in Svelte 5. Where a developer would simply write let count = 0, they now declare count with $state so that the framework explicitly knows that this value must be tracked.

For a React developer, the analogy with useState comes quickly. Yet the behavior remains different: $state does not return an array with a value and a setter, it exposes reactive data directly manipulable in the Svelte ecosystem.

This change has a clear benefit in structured projects. When a team moves logic into a separate file, the reactive behavior remains readable, which reduces ambiguities during code reviews or interface redesigns.

How $derived clarifies computed states

$derived is used to create a value computed from one or more states. In React, an expression like count * 2 can be enough if it is recalculated during the component render, or be wrapped in useMemo when optimization becomes necessary.

In Svelte 5 with Runes, the logic is more explicit, because the framework does not rely on full component re-execution. $derived indicates that the value depends on other reactive data and must be recalculated when those dependencies change.

This model becomes particularly useful on business interfaces. For example, in a bord billing table, a filtered total, a remaining balance, or a risk indicator can be declared as derived values rather than recalculated in a scattered way across multiple UI blocks.

Front-end need Typical React approach Svelte 5 with Runes approach Impact for the team
Local state useState $state More direct declaration, without a separate setter
Calculated value Expression or useMemo $derived More explicit reactive dependencies
Side effect useEffect with dependency array $effect with detected dependencies Less risk of forgetting a dependency
Reusable logic Custom hook Function containing runes Simpler sharing hors component
UI update Component-driven rendering Compiled granular reactivity Less work on the browser side
Read also  Free webmail: your gateway to fluid communication

What $effect brings compared to useEffect

$effect is the rune intended for side effects: synchronization, subscriptions, logging, local calls, or interaction with a browser API. It runs on mount, then runs again lorsque the values used in its bordy change.

The most notable difference for a React profile concerns dependencies. With useEffect, the dependency array requires constant discipline; with $effect, Svelte automatically detects the reactive data being used.

This detection reduces a frequent category of bugs: a forgotten dependency, an effect that does not run again, or excessive reruns after a minor change. But it also requires a precise understanding of which values are being read in the callback.

Custom hooks become more natural in Svelte 5

One of the most interesting changes concerns reusable reactive code. Before Svelte 5, it was often necessary to use stores to cleanly extract shared logic, which added a conceptual layer.

Now, $state, $derived, and $effect can be used in functions. A team can therefore move counter, form, or pagination logic into a separate file without transforming the entire architecture.

The similarity to React custom hooks is obvious. The difference lies in the constraints related to signals: directly returning a value can break reactivity, whereas a getter preserves the link with the tracked state.

  • Use $state for data that actually changes in the interface.
  • Reserve $derived for values calculated from other states.
  • Use $effect for side effects, not to recalculate displayed data.
  • Avoid destructuring a reactive object if it breaks value tracking.
  • Encapsulate business logic in reusable functions when it goes beyond the component.

This point is essential for agencies and product teams. At DualMedia, this type of trade-off often appears lors during a front-end redesign or an architecture audit, especially lorsque the project must remain maintainable over several years.

The pitfalls of signals for React developers

Signals bring fine-grained reactivity, but they change the way of thinking. In React, a value is often read in the context of a full render; in Svelte 5 with Runes, the reactive link must be preserved all the way to the point of use.

The typical case concerns destructuring. If an object contains a reactive property and that property is extracted too early, the code may retrieve a simple frozen value instead of data tracked by the framework.

Another point to watch: getters. In some reusable functions, returning get count() rather than a raw value preserves the expected reactivity. This detail may seem unusual to a React developer, but it quickly becomes second nature in a mature Svelte codebase.

Read also  Ranking 2024: Discover the 100 most popular websites in France

Svelte 5, SvelteKit, and web performance

Svelte retains its historical advantage: a large part of the work is done at compile time. The browser receives more direct JavaScript, without a heavy virtual DOM, which can improrve initial loading and perceived responsiveness on low-end devices.

SvelteKit complements this approach with SSR, SSG, hybrid, or edge rendering depending on the needs. A marketing page can be generated statically, while a client area can use server rendering to display up-to-date data.

For a web or mobile project, this choice must remain pragmatic. An agency like DualMedia can help compare SvelteKit, React, Next.js, or Vue based on real objectives: SEO, performance, maintenance budget, internal skills, and existing technical debt.

Teams that want to further improve their work environment can also review their tools with a guide on what an IDE is, because the quality of the tooling directly influences productivity on Svelte, React, or TypeScript.

When to choose Svelte 5 with Runes rather than React

Svelte 5 with Runes becomes relevant lorsque the team wants to reduce the amount of code, limit the client-side runtime, and build highly reactive interfaces without multiplying abstractions. It is well suited to business applications, dashboards, portails SaaS, advanced prototypes, and interfaces where perceived performance matters.

React remains a solid choice lorsque the existing ecosystem is massive, internal components are already numerous, or large-scale hiring takes priority over technical simplicity. The right choice rarely depends on an isolated benchmark; it depends above all on the project context.

Let’s imagine NovaLearn, a fictitious training platforme historically built in React. To redesign its learner area, the team could test Svelte 5 on an isolated module, measure the maintainability of the code, then decide on a gradual migration rather than a sudden replacement.

In this type of approach, support in web and mobile development helps secure technical choices before committing to a complete redesign. The goal is not to follow a trend, but to reduce risks while improvoring the user experience.

How to gradually migrate from React to Svelte 5

A successful migration rarely begins with a complete rewrite. The most effective approach is to identify a limited scope: widget, standalone page, internal back office, or new module without a strong dependency on the React design system.

This approach allows testing the runes on concrete cases. Developers quickly observe the differences in reasoning between hooks and signals, particularly regarding effects, derived values, and logic sharing.

The transition should be documented from the outset. Naming conventions, rules for using $effect, and reusable function patterns must be explicit to prevent each developer from inventing their own approach.

The skills to strengthen before adopting Svelte 5 with Runes

Svelte remains close to standard JavaScript, which makes upskilling easier. However, Svelte 5 with Runes requires a good understanding of reactivity, closures, getters, and side effects.

Read also  Agence web à Bordeaux : The importance of local SEO for your business

React developers already have an advantage: they understand state, rendering, and lifecycle issues. The difficulty lies in not mechanically carrying over React habits into a more granular compiled model.

Before a production project, it is useful to train the team on a few common cases: complex form, filtered table, API call, animated component, logic sharing, and error handling. HTML basics and code editing also remain important, as this guide on WYSIWYG HTML editors for beginner coders.

Our opinion

Svelte 5 with Runes is moving in a healthy direction: less implicit magic, more readability, and better-structured reactivity for ambitious projects. React developers will find familiar reference points, but will need to accept a stricter signal-based logic.

The framework does not replace React in every context. However, for a new interface, a business application, or a redesign where performance, clarity, and maintainability are prioritary, Svelte 5 clearly deserves to be evaluated.

DualMedia can support this evaluation with a front-end audit, a SvelteKit prototype, or a gradual migration strategy. The right trade-off remains the one that serves the product, the team, and the users, not just the technical preference of the moment.

Does Svelte 5 with Runes replace React hooks?

No, Svelte 5 with Runes does not directly replace React hooks. The runes offer comparable concepts for managing state, derived values, and effects, but they work with Svelte’s compiled reactive model.

What is $state used for in Svelte 5 with Runes?

$state is used to declare a mutable reactive state in Svelte 5. It replaces the old habit of simply using let for certain values tracked by the component.

What is the difference between $derived and useMemo?

$derived declares a value computed from reactive states. Unlike useMemo, it is part of Svelte's signal system and makes the dependency more explicit in the reactive flow.

Does $effect work like useEffect?

$effect is similar to useEffect in its role, but not in how it works exactly. It runs a callback on mount and when its reactive dependencies change, without a manual dependency array.

Is Svelte 5 with Runes simpler than React?

Svelte 5 with Runes can be simpler on some projects thanks to concise syntax and a compiled model. However, signals add rules to understand, especially regarding getters and preserving reactivity.

Can you create custom hooks with Svelte 5?

Yes, Svelte 5 lets you create reusable reactive logic in functions. It’s not exactly a React custom hook, but the result meets the same need for factoring.

Why can destructuring be a problem with Svelte runes?

Destructuring can break the reactive link if it extracts a value too early. In Svelte 5 with Runes, you need to make sure to preserve the tracked data until its actual use.

Does Svelte 5 with Runes improve web performance?

Svelte 5 can improve performance thanks to its compiled model and granular reactivity. However, the gains depend on the project, the existing code, the chosen rendering, and the overall quality of the architecture.

Should you migrate a React project to Svelte 5?

A migration to Svelte 5 should be decided after an audit. It may be relevant for a redesign, a new module, or an application where client-side weight and maintainability are priorities.

Is SvelteKit necessary to use Svelte 5 with Runes?

No, SvelteKit is not required to use runes. It becomes useful lorsque the project needs SSR, SSG, API routes, hybrid rendering, or a full-stack structure.

Is Svelte 5 with Runes suitable for business applications?

Yes, Svelte 5 with Runes is well suited to business applications with complex state and reactive interfaces. Its readability and component model can reduce complexity if the team adopts solid conventions.

Would you like to get a detailed quote for a mobile application or website?
Our team of development and design experts at DualMedia is ready to turn your ideas into reality. Contact us today for a quick and accurate quote: contact@dualmedia.fr

 

English