Skip to content
Advertisement

Object does not hook [closed]

I am trying to learn hooks but have a problem with an object. Looks like useState doesn’t treat my object as an object and I can’t get hold of the second value.

JavaScript

When I console.log the lName, “undefined” pops up, while fName works perfect.

Advertisement

Answer

In the else if (name === "lName") return statement you’re returning a key named lname instead of lName.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement