tests erster React Oberflächen Technik 2

This commit is contained in:
2026-07-29 21:31:50 +02:00
parent 0cc83a0c19
commit 3af4e19522
3 changed files with 25 additions and 11 deletions
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
function UseFetch(url, options) {
function UseFetch(url, options = {method: 'GET'}) {
const [data, setData] = useState(null)
const [isLoading, setIsLoading] = useState(true)
const [error, setError] = useState(null)
@@ -20,7 +20,8 @@ function UseFetch(url, options) {
.then((json) => setData(json))
.catch((err) => setError(err.message))
.finally(() => setIsLoading(false))
})
},[])
return { data, isLoading, error }
}