- Create a new component in
components/Bouncer.js
, with a heading containing the text "Bouncer Page" - In this component, add a
Link
component that will redirect to the home page (/
) - In
App.js
, add aRoute
that will handle the path/bouncer
, and render theBouncer
component in it - In
components/Home.js
, add aLink
that will redirect to the/bouncer
page - You should now be able to switch between the
Home
andBouncer
pages using the links
- In the
components/Bouncer.js
file, use theuseHistory
hook to get thehistory
object - Use the
useEffect
hook and asetTimeout
function to achieve the following effect: - When the user lands on the
Bouncer
page, after a timeout of 5 seconds they get redirected back to theHome
(/
) page.
- Create a new component in
components/NotFound.js
, with a heading containing the text "Page Not Found" - In this component, add a
Link
component that will redirect to the home page (/
) - Use the
useLocation
hook to get the currentlocation
object - Render a paragraph
<p>
, that will print the current location pathname, in a sentence like{pathname} not found
- In
App.js
, add a new Route that will match any path with a wildcard (*
) character and render theNotFound
component - If you put any random path in the browser like
localhost:3000/invalid/page/
, you should se the text "/invalid/page/ not found"
- In the
components/Home.js
file add aform
with oneinput
with thelabel
of "Your favourite artist", and one submitbutton
with the label of "Search" - Add an
onSubmit
handler to the form, which takes the value from theinput
and uses it in ahistory.push()
call, redirecting to/artist/{value from input}
. If I submitMadonna
to the form, it should redirect me to/artist/Madonna
- Create a new component in
components/Artist.js
- Use the
useParams()
hook to get thename
param from the page. Render a heading (h1
) with thename
parameter as text. - Use
axios
in auseEffect
hook to callhttps://www.theaudiodb.com/api/v1/json/1/search.php?s=
+ thename
parameter. (For "Madonna" it will look like this:https://www.theaudiodb.com/api/v1/json/1/search.php?s=Madonna
) - Save the resulting data from the API and print them in the component using
JSON.stringify()
- In
App.js
, add a newRoute
matching/artist/:name
and render theArtist
component in it.
- Use the
Card
component from the Material UI library (@mui/material
) to make the artist component look pretty. - Use the
CardMedia
element to show thestrArtistThumb
image - Use the
CardContent
element to show additional data likestrLabel
orstrCountry
- Use the
CardActions
component together with theChip
component to render thestrStyle
,strGenre
andstrMood
fields - The resulting image could look like this:
- Use other components from the Material UI library to prettify the rest of the page. There's no specific guidance, be creative.
- You could use the
Container
elements to center the content and limit the maximum width, useAppBar
component to give proper headers to all the pages, or use the nice input for the form on the Home page.