"use client";
import Index1 from "./index1";
const Demo = () => {return (<div><Index1 /></div>);};
export default Demo;
export default async function Index1() {
let res = await fetch("https://jsonplaceholder.typicode.com/users");
let repo = await res.json();
return (<div>
{repo && repo.map((user: any) => {user.name})}
</div>);}
Throwing Error in log async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding `’use client’` to a module that was originally written for the server.
Is there is any solution for this scenario ?
New contributor
Rahul Chauhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4