Giter Club home page Giter Club logo

project-movies's Introduction

Project Movies šŸŽ¬

This project is a React app with three pages - one showing a list of movies, one showing details about single movies and one showing a 'not-found-page'. I use the themoviedb.org's API to fetch movies and details data for the movies.

View it live šŸ‘€

https://practical-varahamihira-bdcd3b.netlify.app

My project meets the requirements of having at least two pages and following the provided design. As an added feature I also have a re-directed 'not found' page if a user enters an invalid movie ID. From this page the user can go back (via Link form react-router-dom) to the movies list page.

For this project I have learnt and practiced:

  • How to use React router to create multi-page applications
  • How to use placeholders in urls to pick dynamic parts from urls
  • How to use APIs in React - combining useState, useEffect with useParams

I have also learnt about Route and how to use Link to connect pages together. I created a PopularList component with Route. This route is responsible for the home page. It usesĀ useEffectĀ to run an API request to themoviedb.org and fetch popular films in the US, puts them into state usingĀ useState, and then renders them wrapped in aĀ LinkĀ fromĀ react-router-domĀ to link to the detail page.

The second component MoviesDetails has a route that expects a movie ID in the URL and is responsible for showing more details about a movie after you click on it. It usesĀ useParamsĀ fromĀ react-router-domĀ to get theĀ idĀ from the URL and then passes that into an API call (withinĀ useEffect) to themoviedb.org to fetch details about a single movie, then puts the response into state usingĀ useStateĀ and finally renders it onto the page.

The third component NotFound has a route that redirects the user from a 404 to a custom page. From here the user can get back to the homepage - I use Link to take the user back.

Methods and Tools šŸ› 

  • Route, Link and Redirect from react and react-router-dom
  • useParams, useState and useEffect
  • fetch()

With a little help from my friends... šŸ„°

As always, I have expanded my knowledge with the help of the team, Stackoverflow, Google and our code coaches.

Next step šŸ§ 

As a next step, I would like to build larger sites with more pages and more interactivity.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.