What is wrong here?
Answered
Mallow bee posted this in #help-forum
Mallow beeOP
So it says i cant use async/await in react server components but i have "use client" in my page
"use client";
import React from "react";
import { useSession } from "next-auth/react";
export default async function Home() {
const { data: session, status } = useSession();
return (
<div>
<h1>Hello</h1>
</div>
);
}Answered by riský
make your function (remove the async part) to use client components
export default function Home() {3 Replies
make your function (remove the async part) to use client components
export default function Home() {Answer
@Mallow bee So it says i cant use async/await in react server components but i have "use client" in my page
js
"use client";
import React from "react";
import { useSession } from "next-auth/react";
export default async function Home() {
const { data: session, status } = useSession();
return (
<div>
<h1>Hello</h1>
</div>
);
}
it is saying async await isn't allowed in client components