React,Fetching data

Hi
I am studying the react course and learning the catching process. I code a form like this:

then I code a list by fetching from a website and I want to add the information that is written on the form to the fetching list. the code is :

which I face the error that say :

“Type ‘(string | number)’ is missing the following properties from type ‘User’: id, name ts(2739)”**

Does anyone know the error meaning and how should I solve it?

Because you set your schema with a name property. I would think you would need 2 use states and instead of calling res.data you should call res.user.name in your .then statement. Something along those lines

I would first try to receive the data then console .log it instead of using it right away to look at the shape of the data. If you error there fix your api call, then one step at a time figure out how to handle the data.

I dont get your point. maybe thats because I dont have any background in coding. what I study was: html, css, javascript and know react. so if you could explain your point in a easier way i would be grateful.

and about console, actually I did it and based on what I know it works ,

So that data you receive is an object with 2 properties id and name, there is also all that metadata but no big deal. When you receive the data you send it to a function. What i like to do is break up the data first rather than creating a complicated function.

For example take name and id and send the to separate functions. .then(res) => (namefunction(res.data.name), idfunction(res.data.id)

Then in those functions you put the data somewhere, store it ect.

Are you just trying to get it to work?