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

297
Views
Multiple SVG Components not working or render as expected

I'm having a strange problem; and haven't been able to get a solution for it.

Context: NextJS App. I have 5 different svgs, and created some Icon components with them:

import React from 'react';
import { ReactComponent as NoReactionSvg } from './img/no-reaction.svg';
import { ReactComponent as OkSvg } from './img/ok.svg';
import { ReactComponent as QuestionSvg } from './img/question.svg';
import { ReactComponent as ToolSvg } from './img/tool.svg';
import { ReactComponent as TrophySvg } from './img/trophy.svg';

const Icon = ({ size = 'medium', color = 'currentColor', style, children, ...props }) => {
  const sizes = {
    small: '16px',
    medium: '24px',
    large: '32px',
  };

  return React.cloneElement(children, {
    width: sizes[size],
    height: sizes[size],
    color,
    style,
    ...props,
  });
};

export const NoReactionIcon = (props) => (
  <Icon {...props}>
    <NoReactionSvg />
  </Icon>
);

export const OkIcon = (props) => (
  <Icon {...props}>
    <OkSvg />
  </Icon>
);

export const QuestionIcon = (props) => (
  <Icon {...props}>
    <QuestionSvg />
  </Icon>
);

export const ToolIcon = (props) => (
  <Icon {...props}>
    <ToolSvg />
  </Icon>
);

export const TrophyIcon = (props) => (
  <Icon {...props}>
    <TrophySvg />
  </Icon>
);

And I'm trying to use these components like this:

<div><TrophyIcon /></div>
<div><ToolIcon /></div>
<div><QuestionIcon /></div>
<div><NoReactionIcon /></div>
<div><OkIcon /></div>

Problem is, it's not working as expected. As you can see, I have 5 components; but it's only rendering the first 3 (the other 2 are omitted).

enter image description here

Now, if I move the 4th icon to the top, suddenly it renders! But still the last one is not being rendered.

enter image description here

And If I move it to the top, suddenly the 2nd icon is not being rendered anymore.

enter image description here

I'm totally clueless about what's going on with this. Maybe is it a configuration on nextjs? Or maybe I'm creating these svg components wrong?

about 4 years ago · Juan Pablo Isaza
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!