diff --git a/src/app/testin/page.tsx b/src/app/testin/page.tsx index 436cd84..ae6559d 100644 --- a/src/app/testin/page.tsx +++ b/src/app/testin/page.tsx @@ -3,22 +3,33 @@ import { useState } from "react"; const Testin = () => { const [data, setData] = useState(); + const [num, setNum] = useState(1); const testFetch = async () => { try { - const res = await fetch("https://jsonplaceholder.typicode.com/todos/1"); + const res = await fetch( + "https://jsonplaceholder.typicode.com/todos/" + num, + ); const json = await res.json(); + setNum((prev) => prev + 1); + setData(json); } catch (error) { console.log(error); } }; - testFetch(); - - return