Repository navigation
How to pass a custom "App" component with nested components to the "renderApp" method #49
|
Currently I render my root component in Inertia (React) like this: createInertiaApp({
progress: {
color: "#F19E18",
delay: 150
},
title: (title) => `${title} - ${appName}`,
resolve: (name) =>
resolvePageComponent(
`./Pages/${name}.jsx`,
import.meta.glob("./Pages/**/*.jsx")
),
setup({ el, App, props }) {
root.render(
<FlareErrorBoundary>
<HotkeysProvider>
<RecoilRoot>
<State auth={props?.initialPage?.props?.auth}>
<App {...props} />
</State>
</RecoilRoot>
</HotkeysProvider>
</FlareErrorBoundary>
);
},
});The docs suggest to replace the import { renderApp } from '@inertiaui/modal-react'
createInertiaApp({
setup({ el, App, props }) {
const root = createRoot(el);
root.render(
renderApp(App, props)
);
}
});Simply putting the JSX in the root.render(
renderApp(
<FlareErrorBoundary>
<HotkeysProvider>
<RecoilRoot>
<State auth={props?.initialPage?.props?.auth}>
<App {...props} />
</State>
</RecoilRoot>
</HotkeysProvider>
</FlareErrorBoundary>,
props,
),
);
Any suggestions on how to fix this? |
Answered by
pascalbaljet
Nov 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Closed in #54