[SOLVED] React cant read my argument inside my .map


I have another data folder with nested objects inside arrays I want to access them with .map function. Its working perfectly fine with divs and h3 but when it comes to this it says y is not defined

import Nav from './Nav'
import Cards from './Cards'
import data from './data'

export default function App(){

    return  ( data.map(y =>
        <Nav />,
        title = {y.title} // y is not recognized
     ) )


You need to add brackets:

return  ( data.map(y => (
<Nav />
    title = {y.title} 
) ) )

Answered By – Live bug help – www.dialect.so

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *