Skip to content

How to have behavior like $bindable, but in javascript code? #14410

Answered by brunnerh
0x1618 asked this question in Q&A
Discussion options

You must be logged in to vote

By context, do you mean getContext and setContext?

Yes.

Your solution is nice, but if there are multiple buttons or other components that can possibly take props, they might end up with incorrect props.

It is all manually wired up in the snippet, so I don't understand how things would end up in the wrong place.

Whether you use the exported prop or exported functions does not really matter, the former just gives you read and write access in one.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@0x1618
Comment options

@brunnerh
Comment options

@0x1618
Comment options

@brunnerh
Comment options

Answer selected by 0x1618
@0x1618
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants