Skip to content

InertiaJS + React v.18 #1160

Discussion options

You must be logged in to vote

Here's how I set it up:

import './bootstrap';

import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { App, createInertiaApp } from '@inertiajs/inertia-react';

const rootElement: any = document.getElementById('app');
const root = createRoot(rootElement);

createInertiaApp({
  resolve: (name: string) => {
    return import(`./Pages/${name}`);
  },
  setup({ el, App, props }) {
    root.render(<StrictMode><App {...props} /></StrictMode>);
  },
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MartinLindalHansen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants