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

205
Views
Establecer la clase de cuerpo del casco cuando el elemento está activo

Estoy tratando de crear una superposición de imagen sin desplazamiento y, por lo tanto, necesito diseñar el body cuando mi li está activo. Estoy tratando de hacer esto a través de Helmet , pero no funciona. Simplemente dice <body class=""> en el navegador, sin importar si un li está activo o no.

El componente:

 import React, { useState } from "react" import { Helmet } from "react-helmet" export default function ToggleActive({ children, size }) { const [isActive, setActive] = useState("false") const handleToggle = () => { setActive(!isActive) } return ( <li className={isActive ? size : "active"} onClick={handleToggle}> <Helmet> <body className={isActive ? null : "no-scroll"} /> </Helmet> {children} <button onClick={handleToggle} /> </li> ) }

¿Qué pasa aquí?

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!