feat: pass middleware state in props (#1264)

This commit is contained in:
Reed von Redwitz
2023-06-28 14:53:42 +02:00
committed by GitHub
parent 851f8d60aa
commit 0db3a0911a
12 changed files with 105 additions and 20 deletions
+6
View File
@@ -2,10 +2,16 @@ import { Head } from "$fresh/runtime.ts";
import { AppProps } from "$fresh/server.ts";
export default function App(props: AppProps) {
const statefulValue = props.state?.root === "root_mw"
? "The freshest framework!"
: "";
const specialCase = props.state?.stateInProps as string;
return (
<>
<Head>
<meta name="description" content="Hello world!" />
<meta name="generator" content={statefulValue} />
{specialCase && <meta name="specialTag" content={specialCase} />}
</Head>
<props.Component />
</>