GoProReact

Book Finder (Without Effect)

Instructions

Try selecting different options from the Music Genre dropdown and watch the counter below increase. You'll notice the fetch count goes up with each selection! This happens because, without a properly configured useEffect to sync states, the component re-renders unnecessarily, triggering multiple API calls.

You can also monitor this behavior in your console logs.

Selected Book Genre: Romance

Selected Music Genre: Rock

fetchBooksByGenre called: 0 time(s)

Problem: Because of the absence of a useEffect, the book list doesn't get displayed