A simple React application built as part of a frontend internship assignment.
The app fetches posts from a public API and displays them in a clean, responsive layout with proper loading, error handling, and client-side pagination.
- Fetches data from a public API
- Displays posts in card layout
- Loading state while fetching data
- Error handling with retry option
- Client-side pagination (15 posts per page)
- Responsive design using plain CSS
- React (Functional Components)
- useState & useEffect
- Fetch API
- Plain CSS
- Vite
https://jsonplaceholder.typicode.com/posts
Clone the repository:
git clone https://github.com/YOUR_USERNAME/react-posts-viewer.git
cd react-posts-viewerInstall dependencies:
npm install
Run the development server:
npm run dev
src/
components/
PostCard.jsx
App.jsx
App.css
main.jsx
- Data is fetched once when the component mounts.
- Pagination is handled on the client side to avoid additional API calls.
- Error handling is implemented using try/catch with a retry option.
- The layout uses CSS Grid for responsiveness.