Skip to content

Reactive declaration syntax #8

Open
@jimafisk

Description

@jimafisk

Svelte defines reactive declarations, or variables that automatically update when a value they depend on changes, by highjacking the label syntax for its own purpose. For example, in Svelte that looks like this:

let count = 0;
$: doubled = count * 2;

The label syntax probably seems like foreign to most folks, so I wonder if we should instead adopt the $ syntax that folks sometimes already use for things like denoting jQuery objects in plain JS. So in Pico a reactive declaration would look like this:

let count = 0;
let $doubled = count * 2;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions