#8 showed albums on click

parent 84ad8c8b
import React, {useEffect} from 'react';
import {getAlbumsByQueryParams} from '../features/album/albumSlice';
import {useAppDispatch, useAppSelector} from '../store/hooks';
const Albums = () => {
const {albums} = useAppSelector((state) => state.album);
const dispatch = useAppDispatch();
const params = new URLSearchParams(window.location.search);
const artist = params.get('artist');
useEffect(() => {
dispatch(getAlbumsByQueryParams(artist!));
}, []);
return (
<div>
{albums.map((album) => {
return <div key={album._id}>{album.name}</div>;
})}
</div>
);
};
export default Albums;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment