-
Hello! Sorry for this dumb question. I've never use I tried reading Say for example, in Svelte<label class="form-control">
<input
type="checkbox"
bind:checked={myBoolean}
/>
Check
</label> For value<input
type="number"
use:validator={myNumber}
bind:value={myNumber}
min="0"
/> The P.S. Sorry for my bad English. I'm not a native speaker of English. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
No worries. This framework is fairly different from React but quite similar to SolidJS, so you may have more luck there. In either case, you want to look up React or Solid "controlled components" and "uncontrolled components" for patterns. let (name, set_name) = create_signal(cx, "gbj".to_string());
view! { cx,
<input type="text"
// updates the `value` property in the DOM reactively to match `name`
prop:value=name
// event_target_value is the equiv. of JS event.target.value
// just a helper to smooth out some Rust/JS type awkwardness
on:input=move |ev| set_name(event_target_value(&name))
/>
} The equivalent goes for Basically:
|
Beta Was this translation helpful? Give feedback.
No worries. This framework is fairly different from React but quite similar to SolidJS, so you may have more luck there. In either case, you want to look up React or Solid "controlled components" and "uncontrolled components" for patterns.
The equivalent goes for
prop:checked
andevent_target_checked
on a checkbox.