Skip to content

Explain why $bindable shouldn't be often used #1397

@guillaume-mueller

Description

@guillaume-mueller

https://svelte.dev/docs/svelte/$bindable tells:

Ordinarily, props go one way, from parent to child. This makes it easy to understand how data flows around your app.

In Svelte, component props can be bound, which means that data can also flow up from child to parent. This isn’t something you should do often, but it can simplify your code if used sparingly and carefully.

I think it misses an explanation why it could be done but shouldn't be done often. Or just don't tell anything ?

Actually I see it as a big topic, because I feel that bidirectional binding allows local source of truth and component responsibility, which is the state of art of OOP / SASS / API. I've yet to be convinced why suddenly with UI it's different and the flow should only go one way, because it equals to global variables, which is known to be the enemy of scalability and responsibility.

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