Sometimes it can be useful to transform the props client-side before they are passed to the page component. For example, you may have a collection of errors that you want to convert into a custom Error
object. You can do this using the transformProps
callback.
new Vue({
render: h =>
h(Inertia, {
props: {
initialPage: JSON.parse(app.dataset.page),
resolveComponent: name => require(`./Pages/${name}`).default,
transformProps: props => {
return {
...props,
errors: new Errors(props.errors),
}
},
},
}),
}).$mount(app)