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

171
Views
How Use Link tag with if else condition in nextjs

I am getting response(image with link) from Api(via axios),and i want if "imagelink" is not empty only then "Link" tag should work, in other words "imagelink" is optional field,Here is my code,In other words i just want if "image" have "link"(coming from db via api) only then "link" href should work

{this.state.books.map((post, index) => {
        return (
                 <Link href={post.link}>
                    <img src={post.image} />
                    </Link>
                )
         })}
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!