Flashing Data
You may flash data using theInertia::flash() method, passing a key and value or an array of key-value pairs.
back() is also supported.
flash() onto render(), or vice versa.
Accessing Flash Data
Flash data is available onpage.flash. You may also listen for the global flash event or use the onFlash callback.
The onFlash Callback
You may use theonFlash callback to handle flash data when making requests.
Global Flash Event
You may use the globalflash event to handle flash data in a central location, such as a layout component. For more information on events, see the events documentation.
flash event is not cancelable. During partial reloads, it only fires if the flash data has changed.
Client-Side Flash
You may set flash data on the client without a server request using therouter.flash() method. Values are merged with existing flash data.
TypeScript
You may configure the flash data type globally using TypeScript’s declaration merging.page.flash.toast will be properly typed as { type: "success" | "error"; message: string } | undefined.