Next.js Discord

Discord Forum

Argument of type 'void' is not assignable to parameter of type 'SetStateAction<never[]>'.

Answered
Oak apple gall wasp posted this in #help-forum
Open in Discord
Oak apple gall waspOP
Hello, im a total newbie and new to coding, im facing this problem. How do i see the response i get from a server, im trying to console.log the response but i get nothing. Im doing this with a friend and he handles all the server. Im supposed to receive a token for authentication but im getting nothing.
Answered by averydelusionalperson
by having empty array as default value, ts is assuming data state would be type of array.
View full answer

15 Replies

U can set manual type for data state:
const [data, setData] = useState<object | undefined>()
by having empty array as default value, ts is assuming data state would be type of array.
Answer
Oak apple gall waspOP
It
its still showing the same error
don't you need to return that res.json?
I don't remember correctly, but you need to remember ig
in the first then step
Oak apple gall waspOP
im now facing a new problem where everytime i submit the form page, it just refreshes the page
that is a different question, open a new thread.
so, I assume the current problem is solved?
Oak apple gall waspOP
i think it is
thank you!
your welcome, mark the message that helped you as an answer
Original message was deleted
^