Expand the use of the bind syntax #222
thejackshelton
started this conversation in
Proposals For Qwik
Replies: 1 comment
-
So most of these would be read-only bindings right? Nice! Currently the bind is implemented inside the optimizer but once QwikDev/qwik#7269 lands we can make QwikDev/qwik#6989 work and then we can easily implement all the logic we like for DOM element prop handling. I don't think Qwik Components should have special handling for it because you don't know what the change event is for a given prop, plus it would break passing down binds to DOM elements. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
RFC: Generalized bind: Syntax for HTML Attributes
Problem Statement
Qwik's
bind:
syntax implementation is currently half baked and inconsistent. Supportingbind:checked
andbind:value
for seemingly arbitrary reasons, lacking a systematic approach for consumers to know when they can use the bind syntax on a jsx element.This is not something new, both Svelte and Angular have very similar approaches. Now just because these frameworks support the feature doesn't mean we should do it, but since we've already adopted the API, and it's been public for quite some time now in production apps, I think it would be valuable to make it more powerful.
Example:
I would also strongly suggest reading through how it works with runes (Svelte's version of signals) here:
https://svelte.dev/docs/svelte/bind
Current State:
Currently supported (arbitrarily)
Not supported but equally valid
Proposed Solution / Feature
Proposed Solution
Allow the
bind:
prefix for any boolean or value attribute on HTML elements where two-way binding makes sense.Extend the bind attribute to props, where developers can add their own custom binds.
API Design:
Benefits
Implementation Details
Migration Strategy
This is an additive change. Existing
bind:value
andbind:checked
continue to work.Open Questions
<MySelect bind:value />
Next Steps
Links / References
No response
Beta Was this translation helpful? Give feedback.
All reactions