rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Make an assignment reactive without $: if it has reactive dependencies

Open bomzj opened this issue 2 years ago • 3 comments

  • Start Date: 2023-01-01
  • RFC PR: (leave this empty)
  • Svelte Issue: (leave this empty)

Make an assignment reactive without $: if it has reactive dependencies

Summary

It would be nice to have plain/concise assignment without redundant $: for variables that have reactive dependencies.

Motivation

This is how we do now

let count = 1
$: doubled = count * 2

And this is how it can be

let count = 1
let doubled = count * 2

In case if we need one time doubled to be non reactive we could define it like

const doubled = count * 2

bomzj avatar Jan 01 '23 20:01 bomzj