Skip to content
Advertisement

how to map() in JSX ? ERROR: Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null

Console.log shows objects that I think can be displayed with map (). However, there is an error “Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.” error pic

Where is the problem and how can I map() objects? Thanks! I export contacts.js in App.jsx:

JavaScript

App.jsx look like:

JavaScript

And Card component:

JavaScript

Advertisement

Answer

Add a return statement in the App component:

JavaScript

Notice the return before contacts.map

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement