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

163
Views
Conditional displaying of tab in react

In my Menu component, I have 2 tab like below

                    <span>
                        <Link to="inventory"> Inventory</Link>
                    </span>
                    <span >
                        <Link to="user"> Users</Link>
                    </span>

actually Users I want to display only for users who are admin. so whether user is admin or not I am checking in Admin component.

How can I bring data from Admin on Menu and displayUser tab conditionally?

I know I can wrtie something

{isActive && <Link>} etc

so in my Admin component I am calling API and bringing the data. and checking if particular valus is admin then I am making isActive as true and I need to send it to Menu component.

But I dont know how to bring isActive from Admin into Menu? Could you please help?

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

0

Generally to share a state between all components and refuse prop drilling the best way is use react context or in some cases use redux. https://reactjs.org/docs/context.html ==> react context

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!