Saving Local State
To save local component state to the history state, use theuseRemember feature to tell Inertia which data it should remember.
form state changes, Inertia will automatically save this data to the history state and will also restore it on history navigation.
Multiple Components
If your page contains multiple components that use the remember functionality provided by Inertia, you need to provide a unique key for each component so that Inertia knows which data to restore to each component.Form Helper
If you’re using the Inertia form helper, you can pass a unique form key as the first argument when instantiating your form. This will cause the form data and errors to automatically be remembered.Manually Saving State
TheuseRemember hook watches for data changes and automatically saves those changes to the history state. Then, Inertia will restore the data on page load.
However, it’s also possible to manage this manually using the underlying remember() and restore() methods exposed by Inertia.