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.

TypeError: Cannot read property 'map' of null

See original GitHub issue

I got this error when I run "npm start " after npm install

Warning: Failed propType: Required prop news was not specified in Home. Check the render method of WithStyles(Home). TypeError: Cannot read property ‘map’ of null

  • Home.js:20 new Home /Users/hongpf/hosken5/reacttest/build/webpack:/src/routes/home/Home.js:20:12
  • ReactCompositeComponent.js:148 [object Object].ReactCompositeComponentMixin. mountComponent [reacttest]/[react]/lib/ReactCompositeComponent.js:148:18
  • ReactPerf.js:66 [object Object].wrapper [as mountComponent] [reacttest]/[react]/lib/ReactPerf.js:66:21
  • ReactReconciler.js:37 Object.ReactReconciler.mountComponent [reacttest]/[react]/lib/ReactReconciler.js:37:35
  • ReactCompositeComponent.js:225 [object Object].ReactCompositeComponentMixin. mountComponent [reacttest]/[react]/lib/ReactCompositeComponent.js:225:34
  • ReactPerf.js:66 [object Object].wrapper [as mountComponent] [reacttest]/[react]/lib/ReactPerf.js:66:21
  • ReactReconciler.js:37 Object.ReactReconciler.mountComponent [reacttest]/[react]/lib/ReactReconciler.js:37:35
  • ReactMultiChild.js:241 ReactDOMComponent.ReactMultiChild.Mixin.mountChildren [reacttest]/[react]/lib/ReactMultiChild.js:241:44
  • ReactDOMComponent.js:591 ReactDOMComponent.Mixin._createContentMarkup [reacttest]/[react]/lib/ReactDOMComponent.js:591:32
  • ReactDOMComponent.js:479 ReactDOMComponent.Mixin.mountComponent [reacttest]/[react]/lib/ReactDOMComponent.js:479:29
  • ReactReconciler.js:37 Object.ReactReconciler.mountComponent [reacttest]/[react]/lib/ReactReconciler.js:37:35
  • ReactCompositeComponent.js:225 [object Object].ReactCompositeComponentMixin. mountComponent [reacttest]/[react]/lib/ReactCompositeComponent.js:225:34
  • ReactPerf.js:66 [object Object].wrapper [as mountComponent] [reacttest]/[react]/lib/ReactPerf.js:66:21
  • ReactServerRendering.js:42 [reacttest]/[react]/lib/ReactServerRendering.js:42:38
  • Transaction.js:136 ReactServerRenderingTransaction.Mixin.perform [reacttest]/[react]/lib/Transaction.js:136:20
  • ReactServerRendering.js:40 Object.renderToString [reacttest]/[react]/lib/ReactServerRendering.js:40:24

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
wallenweelcommented, Jun 26, 2016

@ritsuyan @Amorites 其实是GFW的锅(哭笑),如果和我这边一样的话。不想看下面一段的话,直接给cmd做个代理就成了。不过,都是些和开发无关的reactjs的新闻,建议直接在地址栏访问自己的内容,e.g.localhost:3001/about

I have just met this problem.

  1. Try to delete {news.map((item.....))} in Home.js, if no error happen again, restore change and continue following.
  2. Browse localhost:3001/graphql?query={news{title,link,contentSnippet}}(you could find it in index.js within same directory.
  3. More clear error infos show in the Graphiql’s right panel, maybe such as: { "data": { "news": null }, "errors": [ { "message": "request to http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=https://reactjsnews.com/feed.xml failed, reason: connect ETIMEDOUT 216.58.197.106:80", "locations": [ { "line": 2, "column": 3 } ] } ] }
  4. If your errors like mine that is connect etimeout, my solution is by shadowsocks and proxifer two softwores
  5. Redo 2. (do without restarting server

I got lots of data finally and everything looks good, hope you too.

0reactions
ulanicommented, May 27, 2021

@hosken5 thank you very much for crating this issue! Unfortunately, we have close it due to inactivity. Feel free to re-open it or join our Discord channel for discussion.

NOTE: The main branch has been updated with React Starter Kit v2, using JAM-style architecture.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'map' of null - Stack Overflow
the answer is very simple: the type of the input isn't array type, it might be null or undefined . so that it...
Read more >
TypeError: Cannot read property 'map' of null in React.js
The "cannot read property 'map' of null" error occurs when we call the map() method on a null value, most often when initializing...
Read more >
How to Prevent the TypeError: Cannot Read Property Map of ...
A guide on the root cause of 'cannot read map of undefined' as well as techniques and tools to prevent this error.
Read more >
Type error: cannot read property 'map' of null - react JS
How have you defined products is still not clear. I can just guess that its initialized as null in your component and that...
Read more >
can not read property map of undefined | fetch in react using ...
Your browser can't play this video. Learn more. Switch camera ... can not read property map of undefined | fetch in react using...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found