Skip to content

Repository files navigation

📸 React Homework 04 — Image Search Application

This project is an Image Search Application built with React. The main purpose of this homework is to practice working with HTTP requests, React Hooks, and external APIs.


🔗 Project Links


🛠️ Technologies & Libraries Used

  • React — Building the user interface with components and hooks
  • Vite — Fast development environment and build tool
  • Axios — Performing HTTP requests
  • Unsplash API — Fetching images by keyword
  • React Hooks — useState and useEffect
  • React Hot Toast — User notifications
  • React Modal — Modal window implementation
  • CSS Modules — Scoped and modular styling
  • Prettier — Code formatting and consistency

📦 Library Installation

The following libraries were installed manually during the project setup:

npm install axios
npm install react-hot-toast
npm install react-modal

All dependencies are listed in package.json and used throughout the application.


🌍 Image Search Service (Unsplash API)

The application fetches images from the Unsplash API.

  • A developer account was created on Unsplash
  • An application was registered to obtain an Access Key
  • The API key is stored in environment variables (.env)
  • Images are fetched using keyword-based search
  • API request limits (50 requests/hour) are respected

Image usage:

  • small — Gallery thumbnails
  • regular — Modal preview

📂 Project Structure

GOIT-REACT-HW-04
├── node_modules
├── public
├── src
│   ├── assets
│   │   └── react.svg
│   ├── components
│   │   ├── ErrorMessage
│   │   ├── ImageCard
│   │   ├── ImageGallery
│   │   ├── ImageModal
│   │   ├── Loader
│   │   ├── LoadMoreBtn
│   │   └── SearchBar
│   ├── services
│   │   └── unsplash-api.js
│   ├── App.jsx
│   ├── App.css
│   ├── index.css
│   └── main.jsx
├── .env
├── .env.example
├── package.json
├── vite.config.js
└── README.md

📖 Application Description

The Image Search application allows users to search for images by keyword and view results in a responsive gallery.

  • Search images by keyword
  • Fetch data from an external API
  • Display images in a gallery layout
  • Load more images using pagination
  • Show a loader during HTTP requests
  • Handle API errors gracefully
  • Open images in a modal view

🧩 Component Architecture

All components are rendered inside the App component.

App
├── SearchBar
├── ImageGallery
│   ├── ImageCard
│   ├── ImageCard
│   └── ImageCard
├── LoadMoreBtn
├── Loader
├── ErrorMessage
└── ImageModal

🪜 Homework Steps Implementation

  • Step 1: Search images by keyword
  • Step 2: Fetch images using Axios and Unsplash API
  • Step 3: Load additional images with pagination
  • Step 4: Handle loading and error states
  • Step 5: Display large image preview in a modal

🚀 How to Run the Project Locally

npm install
npm run dev

The application will be available at:

http://localhost:5173

📌 Final Notes

This homework focuses on HTTP requests and React Hooks, reinforcing key concepts such as:

  • Side effects with useEffect
  • State management with useState
  • Working with external APIs
  • Component responsibility separation
  • Clean and scalable project structure

It provides a strong foundation for more advanced React applications.

Happy coding! 🚀

About

This project is an Image Search Application built with React. The main purpose of this homework is to practice working with HTTP requests, React Hooks, and external APIs.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages