I have a form that once submitted successfully needs to display a thank you message. If all validation passes in my controller then I return to the current component with a message like so.
return Inertia('Home', [
'message' => 'Your contribution was successful, thank you.',
]);
I took this from https://inertiajs.com/responses however I can't seem to access the message. If I check the network tab once the form has been submitted I can see in the props object my message is there
{
"errors": {},
"auth": {
"user": null
},
"message": "Your contribution was successful, thank you."
}
But I can't get it to display I pass the message into my component like this
interface Props {
message?: string;
}
export default ({ message }: Props) => {
...
}
and display it like
{message && <p>{message}</p>}