Sha256: 247cbaccbd9e049bb9c14456f4b2f58c0a10f8e8b4164874c902fd79d08ba516

Contents?: true

Size: 1010 Bytes

Versions: 4

Compression:

Stored size: 1010 Bytes

Contents

import { createInertiaApp } from '@inertiajs/react'
import { createElement } from 'react'
import { createRoot } from 'react-dom/client'

createInertiaApp({
  // Set default page title
  // see https://inertia-rails.netlify.app/guide/title-and-meta
  //
  // title: title => title ? `${title} - App` : 'App',

  // Disable progress bar
  //
  // see https://inertia-rails.netlify.app/guide/progress-indicators
  // progress: false,

  resolve: (name) => {
    const pages = import.meta.glob('../pages/**/*.jsx', { eager: true })
    return pages[`../pages/${name}.jsx`]

    // To use a default layout, import the Layout component
    // and use the following lines.
    // see https://inertia-rails.netlify.app/guide/pages#default-layouts
    //
    // const page = pages[`../pages/${name}.jsx`]
    // page.default.layout ||= (page) => createElement(Layout, null, page)
    // return page
  },

  setup({ el, App, props }) {
    const root = createRoot(el)

    root.render(createElement(App, props))
  },
})

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inertia_rails-contrib-0.3.0 lib/generators/inertia/install/templates/react/inertia.js
inertia_rails-contrib-0.2.2 lib/generators/inertia/install/templates/react/inertia.js
inertia_rails-contrib-0.2.1 lib/generators/inertia/install/templates/react/inertia.js
inertia_rails-contrib-0.2.0 lib/generators/inertia/install/templates/react/inertia.js