Last active
February 4, 2023 16:31
-
-
Save DevPres/19e2565f9b5e054cf1c7f90c2c3ce38e to your computer and use it in GitHub Desktop.
Qwik- Input with setValue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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