Website Link: https://a-better-movie-search.netlify.app/
Practicing React js The key point of this exercise are:
1.create a react app
2.useState and useEffect -1 (movies,setMovies) where we store the data retreived from the API,
-2(movieName,setMoviename) we set the value to be the 'movieName' by calling the setMovieName to be the value in the input text
- on the button we call the search movie function with the onclick function and after we reset the input text after the click using an empty string
4.we create a conditional statement to show 2 different divs. -if there are contents show the div containing the movie if there are not movie available show a div with a message 'No movie found'
5.IMPORTANT -use the question mark to avoid error when element are not found on the api. Without using the question mark when no element are founded will cause the website to crash,returning an empty page with no element
-here the definition of (optional chaining)
- Create component and pass data down as props
7.Destructure the element from the Api down to the component