InertiaJS + React v.18 #1160
Answered
by
mpavel
MartinLindalHansen
asked this question in
Help (React)
-
According to: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it’s running React 17. Learn more: https://reactjs.org/link/switch-to-createroot // Before
// After
I might be wrong, but this seems to me it is supposed to change within Interia.JS - as we are using the '@inertia' tag ? |
Beta Was this translation helpful? Give feedback.
Answered by
mpavel
Nov 22, 2022
Replies: 1 comment
-
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>);
},
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MartinLindalHansen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how I set it up: