I am working on a React App, and i'm trying to get some data using an
CodePudding user response:
If you use optional chaining (?.
) to catch possible null
/undefined
values, you'll most likely fix the issue.
So like this: let res = response.data.data?.[0];