Skip to content

Instantly share code, notes, and snippets.

@DevPres
Last active February 4, 2023 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevPres/19e2565f9b5e054cf1c7f90c2c3ce38e to your computer and use it in GitHub Desktop.
Save DevPres/19e2565f9b5e054cf1c7f90c2c3ce38e to your computer and use it in GitHub Desktop.
Qwik- Input with setValue
interface IProps {
value: string,
setValue: QRL<(value: any) => void>
}
export default component$((props: IProps) => {
return (
<form>
<input
type="text"
value={props.value}
onInput$={(e: KeyboardEvent) => {
const input = e.target as HTMLInputElement;
props.setValue(input.value)
}}
placeholder="Name"
aria-label="name"
/>
<input type="submit" value="Reset" />
</form>
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment