#undefined data returned by map function

51 messages ยท Page 1 of 1 (latest)

zenith shaleBOT
#

๐Ÿ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

๐Ÿ•ต๏ธ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

โœ… You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

young plume
unique quarry
#

You are logging data in getStaticProps so does the data show in your ide console?

When receiving the data prop in homepage, so before returning the jsx, try to log the data before.

If the data is there,
try to check if the data coming as an object and see if it can be destructured using Object.entries()

inner flax
#

in your home page

#

console.log(data)

#

before returning

#

paste the result here

unique quarry
#

i am not sure why it wouldnt work for u. but ur exact code works for me

young plume
unique quarry
#

give it a try

young plume
unique quarry
#

what version of node, nextjs u have?

young plume
#

14

#

v20.9.0

unique quarry
#

hmm

#

try put the fetch inside a try catch and log the error

young plume
#

still blank ๐Ÿ˜…

unique quarry
#

what browser u are using?

young plume
#

edge

unique quarry
#

try other browser

#

chrome maybe

young plume
#

i got this error in console rning: Extra attributes from the server: data-new-gr-c-s-check-loaded,data-gr-ext-installed

unique quarry
#

nah ignore that

#

thats from grammarly

#

otherwise setup a minimal repo and send link

young plume
#

ok

unique quarry
#

bro u are using app router.

#

data fetching methods for app router is different

#

normal pages router methods dont work on app router

young plume
#

btw is app router new or

unique quarry
#

it is new. but has been there for months now

young plume
#

should i continue with this or

unique quarry
#

many old docs still mention and provide examples for pages router and hence this creates a confusion.

unique quarry
#

if you arent/wont be using any package that does not work/has issues with app router, you would use pages router. else app router is good to go

young plume
#

oh ok hey i want one more help so i did crud app and everything is working but i have to hard reload to see changes in browser

unique quarry
#

on local or prod?

young plume
#

on local

unique quarry
#

you have to provide more details on how you are handling the CRUD operations.

#

like say if you are adding a product, so when navigating back to home. You have to make sure you revalidate the home path. when u do router.push("/"). do revalidate along with it.

#

you can check up revalidation on nextjs from same link above

young plume
unique quarry
#

use revalidatePath or revalidateTag just after u do router.push()

zenith shaleBOT
#
โœ… Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1207966251306061844 message)

toxic surge
#

@young plume please do not delete the original question after it has been answered. Mark the answer instead.