remove data-page
in react
#1609
Replies: 1 comment 1 reply
-
Hi there! It seems like you're facing an issue with removing the To remove the
By following these steps, you should be able to remove the If you need further assistance, please provide more details about your server setup and any relevant code snippets, so I can help you better. |
Beta Was this translation helpful? Give feedback.
-
hi guys,
I got difficult in remove
data-page
.With React.JS and render as SSR, no matter what I did, it always show at initially rendering step.
I tried the following code. But still the same. it only remove after render finished. it's really annoying me.
I do need help. thank you.
ssr.jsx might need to be edit as well.
app.jsx
import './bootstrap';
import '../css/app.css';
import { createRoot } from 'react-dom/client';
import { createInertiaApp } from '@inertiajs/react';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
createInertiaApp({
title: (title) => title + " - " + appName,
resolve: (name) => resolvePageComponent("./Pages/${name}.jsx", import.meta.glob('./Pages/**/*.jsx')),
setup({ el, App, props }) {
delete el.dataset.page;//remove div#app data-page
const root = createRoot(el);
root.render(<App {...props} />);
},
progress: {
color: '#4B5563',
},
});
package.json
I make a minima require project to represent the case.
Laravel, breeze, bootstrap, sass, sass-loader, vite, [email protected]
{ "private": true, "type": "module", "scripts": { "dev": "vite", "build": "vite build && vite build --ssr" }, "devDependencies": { "@headlessui/react": "^1.4.2", "@inertiajs/react": "^1.0.0", "@popperjs/core": "^2.11.6", "@vitejs/plugin-react": "^3.0.0", "autoprefixer": "^10.4.12", "axios": "^1.1.2", "bootstrap": "^5.2.3", "laravel-vite-plugin": "^0.7.8", "postcss": "^8.4.18", "react": "^17.0.2", "react-dom": "^17.0.2", "sass": "^1.63.6", "sass-loader": "^13.3.2", "vite": "^4.4.3" } }
I have found #545 (comment)
But I am a frontend develop. I don`t really get it.
In short, I need div#app render without data-page.
PS. I replace 、 as " for reading;
Beta Was this translation helpful? Give feedback.
All reactions