This project is a React application that allows users to search for artists on Spotify and view their albums. It uses the Spotify Web API to fetch artist and album data.
- Search for artists by name.
- Display a list of albums for the searched artist.
- Uses Spotify's client credentials flow for authentication.
- Clone the repository:
git clone https://github.com/your-username/spotify-artist-search.git cd spotify-artist-search
- Install dependencies:
npm install
- Create a .env file in the root directory and add your Spotify API credentials:
REACT_APP_SPOTIFY_CLIENT_ID=your-client-id REACT_APP_SPOTIFY_CLIENT_SECRET=your-client-secret
- Start the development server:
npm run dev
- Open your browser and navigate to http://localhost:3000
- Enter the name of an artist in the search input and press Enter or click the Search button.
- View the list of albums for the searched artist.
App.jsx: The main component that handles the search functionality and displays the results.
- Uses
useEffect
to fetch the access token from Spotify API on component mount. - Contains the
search
function to fetch artist and album data from Spotify API. - Renders the search input and button, and displays the list of albums.
- React
- Bootstrap (for styling)
- Spotify Web API