JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Editor & Inputs How do I attach custom events to Input with vanilla JS?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #112935
    alex.morris22
    Participant

    Is Smart.Input compatible with routing in web app? How do I preserve state on route changes?

    #112958
    Markov
    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/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.