I think the error is in the way you are using useState. Could you show me a piece of your code, where you declare your variable and where you assign the value? Have you tried to debug the value with maybe an alert()?
useState
alert()