An interactive web application that dynamically fetches and displays images using Unsplash's API. Infinite scrolling ensures that new images are loaded automatically as the user scrolls down. This application is built using React and Tailwind CSS for a seamless and responsive experience.
- Infinite Scrolling: Automatically loads more images when you reach the bottom of the page.
- Search Functionality: Search for images based on keywords.
- Lazy Loading: Images load only when they come into view, optimizing performance.
- Responsive Design: Works beautifully across desktops, tablets, and mobile devices.
- Error Handling: Displays appropriate messages in case of API errors or invalid inputs.
- React: For building a responsive and dynamic user interface.
- JavaScript: Core logic and functionality.
- Tailwind CSS: Styling and responsive design.
- Unsplash API: For fetching high-quality images.
- Node.js (v14 or higher)
- An Unsplash API Key (You can get one by creating a developer account on Unsplash).
- Clone the repository:
git clone https://github.com/your-username/infinite-image-scroll.git cd infinite-image-scroll
- Install Dependencies
npm install
- Set Up Environment Variables : Create a .env file in the root directory and add your Unsplash API key:
VITE_UNSPLASH_API_KEY=your_unsplash_api_key
- Run the Application
-
For Development
npm run dev
-
Open your browser and visit:
http://localhost:5173
-
- Build for Prodction
npm run build npm run preview
This application uses the Unsplash API to fetch images dynamically.
- Endpoint: https://api.unsplash.com/photos/
- Search Endpoint: https://api.unsplash.com/search/photos/
- Authentication: Requires a valid API key.
```bash
GET https://api.unsplash.com/photos/?client_id=your_api_key&page=1
- Parameters:
- query: Search keyword.
- page: Page number for pagination.