// app/Apitest.tsx export default async function Apitest() { // 1. Fetch the data directly in the component const res = await fetch('https://swapi.py4e.com/api/people/1/'); const data = await res.json(); // 2. This console.log will appear in your TERMINAL, not the browser console // because this is a Server Component! console.log("Fetched Pilot:", data.name); return (
Name: {data.name}
Height: {data.height}cm
Mass: {data.mass}kg