eidellev / inertiajs-adonisjs

280 stars 17 forks source link

Title Page doesn't Work #118

Closed decoderid closed 1 year ago

decoderid commented 1 year ago

SOLVED

you need to remove title tag in app.edge

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="icon" type="image/png" href="/favicon.ico">

  @entryPointStyles('app')
  @entryPointScripts('app')

  @inertiaHead
</head>
<body>
  @inertia
</body>
</html>

app.jsx

import * as React from 'react'
import { createInertiaApp } from '@inertiajs/react'
import { createRoot } from 'react-dom/client'
import '../css/app.css'

createInertiaApp({
  title: (title) => `${title} - Testing Title`,
  resolve: (name) => import(`./Pages/${name}`),
  setup: ({ el, App, props }) => createRoot(el).render(<App {...props} />),
})

Home.jsx

import React from 'react'
import { Head } from '@inertiajs/react'
import Layout from '../Layout/Main'

export default function Home() {
  return (
    <Layout>
      <Head title="Home Page" />
      <h1>Home</h1>
    </Layout>
  )
}