import React from 'react'; import useFetch from './useFetch'; function App() { const { data, loading, error } = useFetch('https://jsonplaceholder.typicode.com/posts'); if (loading) return <p>در حال بارگذاری...</p>; if (error) return <p>خطا: {error}</p>; return ( <ul> {data.map(post => ( <li key={post.id}>{post.title}</li> ))} </ul> ); } export default App;