Accessing context API when using inertia.js and code splitting

Viewed 199

I wrote my project in react and now I want to add it to Laravel using inertia.js but I can't access context since I'm using dynamic-import for code splitting. I'm wondering if there is a way to access context in this situation. This is my app.js code:

    import React from 'react'
import { render } from 'react-dom'
import { createInertiaApp } from '@inertiajs/inertia-react'

createInertiaApp({
    resolve: name => require(./src/screens/${name}),
    setup({ el, App, props }) {
        render(<App {...props} />, el)
    },
})
0 Answers
Related