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

205
Views
Component definition is missing display name in functional component

Rendering with map I have a double arrow function returning components and I get a missing display name error

Here is the code

const Sales = (props: Props) => {
  const renderCard = React.useMemo(
    () => (config) => (card, i) => {
      return (
        <div {...config} key={i}>
          <Card Icon={card.Icon} label={card.label} />
        </div>
      );
    },
    [cards]
  );

  return (
    <div title="Sales">
      <div>
        {cards.slice(0, 3).map(renderCard(configOne))}
      </div>
      {/* other stuff */}
      <div>
        {cards.slice(3).map(renderCard(configTwo))}
      </div>
    </div>
  );
};

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

0

I found the solution, I can convert the last function from an arrow to a named function like this

const renderCard = React.useMemo(
  () => (config) =>
    function ICard(card, i) {
      return (
        <div {...config} key={i}>
          <Card Icon={card.Icon} label={card.label} />
        </div>
      );
    },
  [cards]
);

I hope this helps someone else too

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!