Cheese
01/11/2021, 2:27 PMexport async function getServerSideProps({ params }) {
const users = await prisma.user.findMany({
where: {
createdAt: new Date(),
name: params.toString()
}
})
return {
props : { users }
}
}
export default function UserPage({users}){
return (
<>
<Head>
<title>{users.username}</title>
</Head>
<Nav />
<div key={users.id}>
<h1>{users.username}</h1>
<p>{users.bio}</p>
</div>
</>
)
}
Joël
createdAt: new Date(),
Joël
Cheese
01/11/2021, 2:42 PMCheese
01/11/2021, 3:17 PMJoël
Cheese
01/11/2021, 3:56 PMCheese
01/11/2021, 6:47 PMJoël
Ryan
01/12/2021, 9:52 AMDate
objects, so you would need to add this plugin to make it work seamlessly.Cheese
01/12/2021, 11:48 AMRyan
01/12/2021, 11:59 AMwhere
function. You need to install this plugin and add it to your .babelrc
Cheese
01/12/2021, 12:26 PMCheese
01/12/2021, 12:50 PMwait - compiling...
error - ./pages/[...username].tsx
TypeError: E:\libby\libby-web\pages\[...username].tsx: get(...) is not a function
Cheese
01/12/2021, 5:39 PMtim2
01/13/2021, 7:07 PMCheese
01/13/2021, 8:51 PMCheese
01/13/2021, 8:51 PMCheese
01/13/2021, 8:52 PMimport Head from "next/head";
import { PrismaClient } from '@prisma/client';
import Nav from '../components/Nav'
const prisma = new PrismaClient();
export async function getServerSideProps({ params }) {
const users = await prisma.user.findMany({
where: {
name: params.toString()
}
})
return {
props: { users }
}
}
export default function UserPage({ users }) {
return (
<>
<Head>
<title>{users.name}</title>
</Head>
<Nav />
<div key={users.id}>
<h1>{users.name}</h1>
<p>{users.bio}</p>
</div>
</>
)
}
Cheese
01/13/2021, 9:36 PM./pages/[...username].tsx
TypeError: E:\libby\libby-web\pages\[...username].tsx: d(...) is not a function
when I upgraded to next 10.0.5.