question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_document.js - TypeError: Cannot read property 'map' of undefined

See original GitHub issue

nextjs: version 2.2.0

When I used _document.js like document mentioned. I have this issue. Is there any solution for this case?

I tried some examples using _document.js. It is still the same

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
tz5514commented, Apr 30, 2017

This problem will occur when nextjs version is 2.3-alpha1, working good when 2.2.0

3reactions
aranajhonnycommented, Apr 30, 2017

Adding this in _document.js works fine. source

static getInitialProps ({ renderPage }) {
    const {html, head, chunks} = renderPage()
    return { html, head , chunks}
  }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : Cannot read property 'map' of undefined - Stack Overflow
The error occur mainly becuase the array isnt found. Just check if you have mapped to the correct array. Check the array name...
Read more >
How to Prevent the TypeError: Cannot Read Property Map of ...
As a result, the TypeError Cannot read property 'map' of undefined is very common and one of the first errors that developers will...
Read more >
can not read property map of undefined | fetch in react using ...
JavaScript Optional Chaining in 5 Minutes (No more " cannot read property of undefined "!) · Let's build Amazon 2.0 with NEXT. JS...
Read more >
Can Not Read Properties of Undefined Reading Map in React ...
If you are looking at can not read properties of undefined reading map in react js error or map function is not displaying...
Read more >
How to Read React Errors (fix 'Cannot read property of ...
This error usually means you're trying to use .map on an array, but that array isn't defined yet. That's often because the array...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found