GifproGifpro

React to $state Changes! Svelte 5 Runes Magic

CODE PREVIEW

エディタを読み込み中…
P

Prompt

Create an interactive demo of Svelte 5's new runes system ($state, $derived, $effect) with a simple counter and derived value. Show real-time reactivity.

Svelte 5 Runes は、リアクティブな状態管理のための新しいプリミティブです。$state$derived$effect を使うと、カウンターの値が変わると派生値(2倍)が自動更新され、エフェクトが変更をログに記録します。もはや let + 再代入パターンは不要で、宣言的でクリーンなリアクティビティを実現します。

+1 や Reset をクリックして、リアルタイム更新を試してみてください。Runes システムはコードをより予測可能で読みやすくし、特に複雑なコンポーネントで力を発揮します。

Prompt Overview

Svelte 5 Runes are a new set of primitives for reactive state management: $state, $derived, and $effect. This demo shows a simple counter that updates a derived value (doubled) automatically, with an effect logging every change. No more let + reassignment patterns—just clean, declarative reactivity.

Try clicking +1 or Reset to see real-time updates. The runes system makes your code more predictable and easier to read, especially in complex components.

Was this prompt helpful?

Comments

Comments appear after moderation

この記事が役に立ったら投げ銭で応援

Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済

開発者が選ぶ最強ツール集

運営者が毎日使っているツール・ガジェット 6選

見る
Homeヘルプ