Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update defining a root element page #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions resources/js/Pages/client-side-setup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ export default function () {
</P>
<H2>Defining a root element</H2>
<P>
By default, Inertia assumes that your application's root template has a root element with an <Code>id</Code> of{' '}
<Code>app</Code>. If your application's root element has a different <Code>id</Code>, you can provide it using
the <Code>id</Code> property.
Changing the id requires update to both server-side and client-side code. For more information, please check{' '}
<A href="server-side-setup#defining-a-root-element">server-side installation page.</A> Setting on the
client-side, you can provide it using the <Code>id</Code> property.
</P>
<CodeBlock
language="js"
Expand Down
26 changes: 26 additions & 0 deletions resources/js/Pages/server-side-setup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const meta = {
{ url: '#root-template', name: 'Root template' },
{ url: '#middleware', name: 'Middleware' },
{ url: '#creating-responses', name: 'Creating responses' },
{ url: '#defining-a-root-element', name: 'Defining a root element' },
],
}

Expand Down Expand Up @@ -143,6 +144,31 @@ export default function () {
},
]}
/>
<H2>Defining a root element</H2>
<P>
By default, Inertia assumes that your application's root template has a root element with an <Code>id</Code> of{' '}
<Code>app</Code>. If your application's root element has a different <Code>id</Code>, you need to update a code
on both the server side and the client side. For instance, if the <Code>id</Code> is <Code>my-app</Code>, you
should write <Code>@inertia('my-app')</Code> on the server side. Also, you will need to make the corresponding
changes <A href="/client-side-setup#defining-a-root-element">on the client side.</A>
</P>
<TabbedCode
examples={[
{
name: 'Laravel',
language: 'markup',
code: dedent`
<!DOCTYPE html>
<html>
...
<body>
@inertia('my-app')
</body>
</html>
`,
},
]}
/>
</>
)
}