Skip to content

const root = document.getElementById('app') return null  #120

@q8tywolf

Description

@q8tywolf

Hello

I have a weird issue
routes
Route.get('/test', async ({ inertia }) => { Logger.debug('hit /test') return inertia.render('Test', { someData: 'hello' }, { title: "welcome to test " }) })
app.tsx
import { InertiaApp } from '@inertiajs/inertia-react'
import React from 'react'
import ReactDOM from 'react-dom'
import '../css/app.css'

// initial page object with props from server
const root = document.getElementById('app')

console.log(root)
const page = JSON.parse(root?.dataset.page as string)

// dynamically load specified page component from "resources/js/Pages/." dir
async function resolver(pageName) {
const module = await import(./Pages/${pageName})
return module.default
}

function App() {
return <InertiaApp initialPage={page} resolveComponent={resolver} initialComponent={''} />
}

ReactDOM.render(, root)

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions