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.
createApp({
render: () => h(App, {
initialPage: JSON.parse(el.dataset.page),
resolveComponent: name => require(`./Pages/${name}`).default,
transformProps: props => {
return {
...props,
errors: new Errors(props.errors),
}
},
}),
}).mount(el)