Created
March 9, 2023 21:58
-
-
Save jrson83/822b6fea1329287376a52b887bc16394 to your computer and use it in GitHub Desktop.
persistent layouts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Layout from '../Layouts' | |
import { Fragment } from 'react' | |
const Home: React.FC = () => { | |
return ( | |
<Fragment> | |
<h1>Home</h1> | |
<p>Hello, welcome to your first Inertia app!</p> | |
</Fragment> | |
) | |
} | |
// Property 'layout' does not exist on type 'FC<{}>'.ts(2339) | |
// | | |
// | | |
// | (parameter) page: any - Parameter 'page' implicitly has an 'any' type.ts(7006) | |
// | | | |
Home.layout = (page) => <Layout title="Home">{page}</Layout> | |
export default Home |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Link } from '@inertiajs/react' | |
const Layout: React.FC<{ title?: string; children?: React.ReactNode }> = ({ | |
children, | |
}) => { | |
return ( | |
<main> | |
<header> | |
<Link href="/">Home</Link> | |
<Link href="/about">About</Link> | |
<Link href="/contact">Contact</Link> | |
</header> | |
<article>{children}</article> | |
</main> | |
) | |
} | |
export default Layout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment