1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-28 01:10:52 +01:00
upscayl/renderer/pages/initial-props.tsx
Nayam Amarshe 0e1e2d1229 Init
2022-08-02 14:28:24 +05:30

36 lines
863 B
TypeScript

import Link from 'next/link'
import { useRouter } from 'next/router'
import Layout from '../components/Layout'
import List from '../components/List'
import { User } from '../interfaces'
import { findAll } from '../utils/sample-api'
type Props = {
items: User[]
pathname: string
}
const WithInitialProps = ({ items }: Props) => {
const router = useRouter()
return (
<Layout title="List Example (as Function Component) | Next.js + TypeScript + Electron Example">
<h1>List Example (as Function Component)</h1>
<p>You are currently on: {router.pathname}</p>
<List items={items} />
<p>
<Link href="/">
<a>Go home</a>
</Link>
</p>
</Layout>
)
}
export async function getStaticProps() {
const items: User[] = await findAll()
return { props: { items } }
}
export default WithInitialProps