TypeError: Cannot read property 'map' of null
See original GitHub issueI 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:
- Created 7 years ago
- Comments:15 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ritsuyan @Amorites 其实是GFW的锅(哭笑),如果和我这边一样的话。不想看下面一段的话,直接给cmd做个代理就成了。不过,都是些和开发无关的reactjs的新闻,建议直接在地址栏访问自己的内容,e.g.
localhost:3001/about
I have just met this problem.
{news.map((item.....))}
in Home.js, if no error happen again, restore change and continue following.localhost:3001/graphql?query={news{title,link,contentSnippet}}
(you could find it in index.js within same directory.{ "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 } ] } ] }
I got lots of data finally and everything looks good, hope you too.
@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.