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

251
Views
How to detect if a child have a specific className in React js

I'm trying to add a className to the ul element if contains a child with an specific className. Using only css it's not possible (it's :has but only in css 4). I'm trying to made this with react but I can't figure it out.

const MenuLink = () => (
<ul className="parent">
    <li>
        <NavLink activeClassName="is-active" className="link">
            link 1
        </NavLink>
    </li>
    <li>
        <NavLink activeClassName="is-active" className="link">
            link 2
        </NavLink>
    </li>
    <li>
        <NavLink activeClassName="is-active" className="link">
            link 3
        </NavLink>
    </li>
</ul>

);

I want to add a class to the ul if .is-active is present in a children.

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!