Skip to content

Commit 45f041b

Browse files
committed
Update client-side-setup.mdx
1 parent a833796 commit 45f041b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

v2/installation/client-side-setup.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,20 @@ createInertiaApp({
247247
```
248248

249249
If you change the `id` of the root element, be sure to update it [server-side](/v2/installation/server-side-setup#root-template) as well.
250+
251+
## Script Element for Page Data
252+
253+
By default, Inertia stores the initial page data in a `data-page` attribute on the root element. You may configure Inertia to use a `<script type="application/json">` element instead, which is slightly faster and easier to inspect in your browser's dev tools.
254+
255+
```js
256+
createInertiaApp({
257+
// ...
258+
defaults: {
259+
future: {
260+
useScriptElementForInitialPage: true,
261+
},
262+
},
263+
})
264+
```
265+
266+
Be sure to also update your [SSR entry point](/v2/advanced/server-side-rendering#add-server-entry-point) if you're using server-side rendering. Laravel users should also set the `inertia.use_script_element_for_initial_page` config value to `true` so the `@inertia` Blade directive outputs a script element.

0 commit comments

Comments
 (0)