docs: improve examples and fix app wrapper (#1244)

This commit is contained in:
Luca Casonato
2023-06-03 22:20:18 +02:00
committed by GitHub
parent a724f6c591
commit 96be590a90
4 changed files with 9 additions and 39 deletions
-29
View File
@@ -23,32 +23,3 @@ export default function App({ Component }: AppProps) {
);
}
```
There is also a possibility to modify the document template by using special
tags `html`, `Head` or `body`. This can be done in any other Preact component,
but using it in the application wrapper lets you define one common document
template.
```tsx
// routes/_app.tsx
import { asset, Head } from "$fresh/runtime.ts";
import { AppProps } from "$fresh/src/server/types.ts";
export default function App({ Component }: AppProps) {
return (
<html data-custom="data">
<Head>
<title>Fresh</title>
<link rel="stylesheet" href={asset("style.css")} />
</Head>
<body class="bodyClass">
<Component />
</body>
</html>
);
}
```
Currently, there is no way of overriding default tags/attributes from provided
template.