Complete the code to export a server component that receives props.
export default function Page({ [1] }) {
return <h1>{message}</h1>;
}The component receives message as a prop and uses it inside JSX.
Complete the code to fetch data on the server and pass it as props.
export default async function Page() {
const data = await fetch('/api/data').then(res => res.json());
return <h1>{data.[1]</h1>;
}The fetched JSON has a message property used in JSX.
Fix the error in passing server data to a client component.
import ClientComponent from './ClientComponent'; export default async function Page() { const data = await fetch('/api/data').then(res => res.json()); return <ClientComponent [1] />; }
Props must be passed as data={data} to the client component.
Fill both blanks to create a server component that fetches data and passes it to a client component.
import ClientComponent from './ClientComponent'; export default async function Page() { const [1] = await fetch('/api/info').then(res => res.json()); return <ClientComponent [2]=[1] />; }
The variable info holds fetched data and is passed as prop info.
Fill all three blanks to pass server data as props and render it in a client component.
import ClientComponent from './ClientComponent'; export default async function Page() { const [1] = await fetch('/api/user').then(res => res.json()); return <ClientComponent [2]=[1] [3]="active" />; }
The fetched data is stored in user, passed as prop user, and a string prop status is set to "active".
