-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
This warning may need to be removed...
State referenced in its own scope will never update. Did you mean to reference it inside a closure?
<script>
let name = $state("John");
name = "Jane";
</script>
<h1>Hello {name}</h1>
This is taken directly from your examples on how to update state.
Reproduction
<script>
let name = $state("John");
name = "Jane";
</script>
<h1>Hello {name}</h1>
Logs
No response
System Info
System:
OS: macOS 14.4
CPU: (10) arm64 Apple M1 Pro
Memory: 703.05 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.7.0 - /opt/homebrew/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.5.0 - ~/Programming/superbuildpro/node_modules/.bin/npm
bun: 1.0.30 - /opt/homebrew/bin/bun
npmPackages:
svelte: ^5.0.0-next.82 => 5.0.0-next.82Severity
annoyance
hanszoons, SikandarJODD, Nelhoa, rChaoz, markjaquith and 5 more
Metadata
Metadata
Assignees
Labels
No labels
