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

139
Views
How can i proper set link to react icon using React styled components

I'd like set link for my Facebook and Instagram React icons. I have simply this code which is imporant for this question. For links inside the project i used React Router Dom but i've never needed link something outsite. How can i proper do it please? I tried something like <FacebookIcon to = "" /> and <FacebookIcon href = "" /> but nothing happened.

index.js

<SocialWrapper>
 <FacebookIcon/>
 <InstagramIcon/>
</SocialWrapper>

styles.js

export const SocialWrapper = styled.div`
  width: 100%;
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
`

export const FacebookIcon = styled(FaFacebookF)`
  color: ${white};
  font-size: 2.3rem;
  
  &:hover{
    color: ${red}
  }
`

export const InstagramIcon = styled(FaInstagram)`
  color: ${white};
  font-size: 2.3rem;
    &:hover{
        color: ${red}
    }
`
about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

Your going to want to wrap the Styled icon in an anchor tag with a href to your profiles. You wouldn't be able to use React Router Link to go to an external page as you have already seen and you wouldn't want to just throw a href or a button event onto an icon. Something like this should be what your after:

<a href="https://facebook.com/ProfileName">
  <StyledIcon />
</a>

MDN Anchor element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

about 4 years ago · Santiago Gelvez Report

0

You can just put in the style or css this property

background-image: url()

Where you pass a string of a file directory or a web address

about 4 years ago · Santiago Gelvez 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!