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

231
Views
Conditionally render a component React

In my application, I want to conditionally render 2 different Tooltip from recharts library depending if level.value != "A"

As seen below, I try to achieve this by using a ternary operator, as modeled in this article https://flexiple.com/react/conditional-rendering-in-react/. However, now no Tooltip shows up if the level is A or not. Also when I console.log(level.value != "A") it is evaluating correctly.

return(
    <>
//other code
        <div>
           {(level.value != "A") ? (
             <Tooltip labelStyle={{ color: "black" }} />
           ) : (
            <Tooltip content = {<CustomTooltip/> } labelStyle={{ color: "black" }} />
           ) }            
        </div>   
    </>
);

Update: Needed !== instead of !=

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!