Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
map function not showing elements on screen

i have this part of code the map function did not show any element of the array, if i console.log the variable it shows me the elements but for some reasons i can't show the elements on the screen.

Code



function Solution({list}){
  const data = list
    console.log(data);
    return(
        <div>
            {
                data?.map((item) => {
            
                    return (
                        <div>
                            <p> {item.title} </p>
                        </div>
                    )
                })
            }
        </div>
    )

}

export default Solution;


const list = [
    {
       
         title: "Home"
    },
    {
      
        title: "Service",
        subItem: ["Clean", "Cook"]
    },
    {
   
        title: "Kitchen",
        subItem: ["Wash", "Dish"]
    },
];


Solution({list})

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Please, just pass "list" link this.

<Solution list={list}/>

Hope will help you, Thanks)

about 4 years ago · Juan Pablo Isaza Report

0

Check this out

import React from 'react';

function Solution({list}){
  const data = list
    console.log(list);
    return(
        <div>
            {
                data?.map((item) => {
                    return (
                        <div key={item.id}>
                            <p> {item.title} </p>
                        </div>
                    )
                })
            }
        </div>
    )
}

export function App(props) {

const list = [
    {
        id:1,
         title: "Home"
    },
    {
        id:2,
        title: "Service",
        subItem: ["Clean", "Cook"]
    },
    {
        id:3,
        title: "Kitchen",
        subItem: ["Wash", "Dish"]
    },
];

  return (
    <div className='App'>
      <Solution list={list} />
    </div>
  );
}

// Log to console
console.log('Hello console')

Have a unique key prop for each element when you map an array and send list array as props to your Solution component

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!