Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › Editor & Inputs › How do I attach custom events to Input with vanilla JS? › Reply To: How do I attach custom events to Input with vanilla JS?
September 11, 2025 at 9:15 am
#112958
Keymaster
Hi,
Preserving State on Route Changes.
You can bind to React State
import React, { useState } from "react";
import { Input } from "smart-webcomponents-react/input";
export default function MyForm() {
const [value, setValue] = useState("");
return (
<div>
<Input
value={value}
onChange={(e) => setValue(e.detail.value)} // Smart.Input passes value in e.detail.value
placeholder="Type something..."
/>
<p>You typed: {value}</p>
</div>
);
}
Best regards,
Markov
Smart UI Team
https://www.htmlelements.com/