Created
September 11, 2022 12:40
-
-
Save marvinhagemeister/0d88f57db298dc8284f34aa1c689b157 to your computer and use it in GitHub Desktop.
usignal diamond scenario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { signal, computed, effect } from "../esm/index.js"; | |
const a = signal(1); | |
const b = computed(() => a.value); | |
const c = computed(() => a.value); | |
const d = computed(() => b.value + c.value); | |
effect(() => console.log(d.value)); | |
a.value = 2; // Should log 4, but logs 2 | |
a.value = 3; // Should log 6, but logs 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment