A React-based web application that allows users to search and display GIFs using the GIPHY API. Users can add search categories and view a grid of related GIFs for each category.
- Search and display GIFs from GIPHY
- Add multiple search categories
- Responsive grid layout
- Loading states for better user experience
- No duplicate categories allowed
- Real-time GIF fetching
- React 18
- Vite
- GIPHY API
- Custom Hooks
- CSS for styling
Before you begin, ensure you have the following installed:
- Node.js (latest LTS version recommended)
- npm (comes with Node.js)
- Clone the repository:
bash
Copy
git clone <repository-url> cd gif-expert-app
- Install dependencies:
bash
Copy
npm install
- Create a
.env
file in the root directory and add your GIPHY API key:
bash
Copy
VITE_GIPHY_API_KEY=your_api_key_here
- Start the development server:
bash
Copy
npm run dev
Copy
gif-expert-app/ ├── src/ │ ├── components/ │ │ ├── AddCategory/ │ │ └── GifGrid/ │ ├── helpers/ │ │ └── getGifs.js │ ├── hooks/ │ │ └── useFetchGifs.js │ ├── GifExpertApp.jsx │ ├── main.jsx │ └── styles.css ├── package.json └── vite.config.js
- The app starts with a default category "One Punch"
- Use the input field at the top to add new search categories
- Each category will display up to 10 related GIFs
- The app prevents duplicate categories
- GIFs are loaded with a loading state indicator
The main component that manages the application state and renders the category list.
Handles the input form for adding new categories.
Displays the grid of GIFs for each category using the custom useFetchGifs
hook.
A custom hook that manages:
- Loading states
- GIF fetching
- State updates for the GIF grid
Handles the GIPHY API communication:
- Fetches GIFs based on search category
- Formats the response data
- Returns standardized GIF objects
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production build
Required environment variables:
VITE_GIPHY_API_KEY
- Your GIPHY API key