A movie search and personal-rating app — search for any movie, see its details, rate it yourself, and keep a running watched list with average ratings and stats. Built specifically to practice writing and reusing custom React hooks.
Tech stack: React (Create React App) · OMDb API
- Live movie search against the OMDb API with results rendered as you type.
- A star-rating component (
stars.js) built from scratch — hover states, click-to-rate, and half/full-star display — instead of pulling in a rating library. - Two custom hooks that do real work:
useMovies(handles fetching, loading, and error state for the search, including request cancellation on new searches) anduseLocalStorage(a generic hook that syncs any piece of state tolocalStorageautomatically). - A watched-movies list with derived stats (average IMDb rating, average user rating, average runtime) computed from the list itself rather than stored separately.
- Keyboard shortcuts — e.g.
Escapeto close a selected movie, usinguseRefand event listeners cleaned up properly on unmount.
- Writing genuinely reusable custom hooks —
useLocalStorageisn't specific to this app; I learned to design a hook so it takes the key and initial value as parameters instead of hardcoding them. - Handling race conditions in data fetching —
useMoviestaught me why you need to cancel or ignore stale requests when the user types fast and multiple fetches are in flight at once. - Derived state vs. stored state — computing the average ratings from the watched list on every render instead of maintaining a separate "stats" state that could drift out of sync.
useReffor things other than DOM nodes — using it to track values across renders without triggering a re-render (e.g. countdown/keyboard logic).- Building a UI control (star rating) from first principles instead of reaching for a library, to actually understand hover/click state management.
npm install
npm start