diff --git a/app/page.tsx b/app/page.tsx index e84cac1..0a53772 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,7 +1,7 @@ import Image from "next/image"; -async function getData() { - const res = await fetch('https://my-json-server.typicode.com/typicode/demo/posts'); +async function getData( url: string ) { + const res = await fetch( url ); // The return value is *not* serialized // You can return Date, Map, Set, etc. @@ -14,10 +14,12 @@ async function getData() { } export default async function Home() { - const data = await getData(); + const data = await getData( "http://localhost:4000/questions" ); return (
-

{ data[ 1 ].title }

+ { data.map( (item: any) => ( +

{ item.question }

+ ) ) }
); } diff --git a/tsconfig.json b/tsconfig.json index e7ff90f..1fa5c96 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, - "strict": true, + "strict": false, "noEmit": true, "esModuleInterop": true, "module": "esnext", @@ -12,6 +12,7 @@ "isolatedModules": true, "jsx": "preserve", "incremental": true, + "noImplicitAny": false, "plugins": [ { "name": "next"