I’m a new student of next-js, I currently learning on database/calling arrays.
I have this files structure & script (in this image) trying to call arrays from /data
.
The problem with this script is, it is pointing Error: Cannot read properties of undefined (reading 'map')
to .map
.
My question is, what is wrong with the script?
And then, there are some solution I read from the community to add &&
or id?.map
. So I try to use newlink && newlink.map
and newlink?.map
for my script. The result is, yes it fix the script to be able to compile, but there is no arrays displayed.
How to fix this error?
How to display arrays using Array<Linklist>
?
Dwipa Arantha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.