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

167
Views
Iterating through an array of objects in react to display a vertical scrolling item (Name & Logo)

I'm trying to create a vertical scrolling ticker/item list that displays the name and logo of each object within the array I set up.

I was able to successfully set up a scrolling ticker of names using some webkit animations on styled components. I originally had it set up as just an array though and now I'm adding logo's to each so I decided to change it to an array of objects shown below:

    export const businessNames = [

        {
            "name":"example name",
            "logo":"logo-url.com/business.jpeg"
        },
        {
            "name":"business name two",
            "logo":"https://sirv.com/logourl.jpeg"
        }
    ]

What's the easiest way to convert the following function to iterate through the objects to capture both the name of the business and display the logo as well?

<!-- language: reactjs -->
import { businessNames } from './businesses';
import { BusinessName } from './styles/index.jsx';

    function VerticalTicker(){
        const renderBusinesses = (names) => {
            let nameArray = [];
            let tickerCount = 0;
            let delay = 0;

            for(const name of names){
                nameArray.push(
                    <BusinessName tickerCount={tickerCount} delay={delay}>{name}</BusinessName>
                )
                tickerCount++;
                delay+= 0.5;
            }
            return nameArray;
        }

return(
        <>

            <div >
                    {renderBusinesses(businessNames)}
            </div>
        </>
    )
}

I've tried a few different looping iterations but my main problem is iterating the object correctly and pushing that info into the nameArray to display both the name and logo image. I feel like im close but if someone can guide me in the right direction i would appreciate it

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

0

To display an array of objects in jsx you can use javascripts .map() function

{businessNames &&
businessNames.map(({ name, logo }) => (
    <p>{name}</p>
    <p>{logo}</p>
))}

I dont quite understand the makeup of your BusinessName component, but its much easier to do the iterating in the jsx.

(If you want to clarify comment)

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!