import { useEffect, useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
function App() {
const [user, setUser] = useState([])
const [ageValue,setAgeValue] =useState('')
const url = 'https://dummyjson.com/products';
// const url = 'https://dummyapi.online/api/movies';
const updateAgeValue = (e) => {
console.log(e.target.value)
setAgeValue(e.target.value)
}
async function fetchApi(url) {
const res = await fetch(url)
const data = await res.json();
console.log(data.products)
setUser(data.products)
// console.log(user,"user")
}
useEffect(() => {
fetchApi(url)
}, [])
if (ageValue < 20) {
return (
<>
Hello frind
>
)
} else {
return (
<>
Hello Vite Project
{
user.map((item) =>
<>
>
)
}
>
)
}
}
export default App