inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Inertia-React v18 Laravel compatibility problem

Open XavierMaster opened this issue 3 years ago • 1 comments

Discussed in https://github.com/inertiajs/inertia/discussions/1167

Originally posted by xaviermaster May 3, 2022 Hi, I am currently working with inertiajs/inertia-laravel": "^0.5.4" and using the new versions of react and react-dom:18 the problem I am facing is by following the documentation

Documentation

I get the next warning. So render it not working properly

problem_

peer_dependency

I was trying to use react-dom/client instead of react-dom but again more problem. Has anyone faced this problem recently and solved it? It it's possible to upgrade the web documentation based on new react version? Thanks in advanced

XavierMaster avatar May 03 '22 16:05 XavierMaster

Possible similar issue #1152

Its not related. React 18 implements a new way to attach the root component to the dom.

@xaviermaster You need to use the new React 18 api. Try this:

import { createRoot } from "react-dom/client";
import { createInertiaApp } from "@inertiajs/inertia-react";

createInertiaApp({
  resolve: (name) => require(`./Pages/${name}`),
  setup({ el, App, props }) {
    const root = createRoot(el);

    root.render(<App {...props} />);
  },
});

lcdss avatar May 16 '22 15:05 lcdss

Hey! Thanks so much for your interest in Inertia.js and for sharing this issue/suggestion.

In an attempt to get on top of the issues and pull requests on this project I am going through all the older issues and PRs and closing them, as there's a decent chance that they have since been resolved or are simply not relevant any longer. My hope is that with a "clean slate" me and the other project maintainers will be able to better keep on top of issues and PRs moving forward.

Of course there's a chance that this issue is still relevant, and if that's the case feel free to simply submit a new issue. The only thing I ask is that you please include a super minimal reproduction of the issue as a Git repo. This makes it much easier for us to reproduce things on our end and ultimately fix it.

Really not trying to be dismissive here, I just need to find a way to get this project back into a state that I am able to maintain it. Hope that makes sense! ❤️

reinink avatar Jul 28 '23 01:07 reinink