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