Computed expressions
Computed signals are read-only values that automatically update when the signals they depend on change.
They don’t have set or update methods because their value is derived from other signals — not manually changed.
I will give you real-world example.
🍹 Lemonade Example:
Signals are like the ingredients:
- You have a
lemonCountsignal and asugarSpoonssignal.
Computed signal is like the taste of the lemonade.
- You don’t set the taste directly. Instead, the taste depends on the number of lemons and sugar.
So if you update lemonCount or sugarSpoons, the taste (computed signal) automatically changes based on those values — you never change the taste directly.
Get Ruchi Sharma’s stories in your inbox
Join Medium for free to get updates from this writer.
So, to use it:
const lemonCount = signal(2);
const sugarSpoons = signal(3);
const taste = computed(() => {
return lemonCount() > sugarSpoons() ? 'sour' : 'sweet';
});You can’t do taste.set('neutral'), because taste is computed from the other two, it reacts, not acts.




