DEV Community

Discussion on: Quick Introduction to React Custom Hooks With Dropdown Selection

 
vunderkind profile image
mogwai

Ah, seen!

Let's try debugging: Instead of fetching category[0].title, see if you can fetch category and either plant a debugger or log category to the console. We need to make sure the fetch is happening correctly, then check to see if the title key is present in the returned array object.

I suspect the problem is from the fetch in your hook, instead of in the assignment syntax afterward. Let me know what is returned from your API when you debug.