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

164
Views
¿Cómo dar clase a DOMelements usando querySelectorAll en React useLayoutEffect?

Mis aplicaciones tienen calendario (usando FullCalender).
Quiero dar clase a los elementos usando querySelectorAll antes de la primera representación.
Entonces, uso React Hooks useLayoutEffect. Pero no funciona.
Por favor, dime cómo resolver este problema.

 let availableDateList = []; const Calender = () => { const setAvailableDateListClass = () => { availableDateList.map((availableDate) => document .querySelectorAll('[data-date="' + availableDate + '"]') .forEach((date) => date.classList.add("available")) ); }; useLayoutEffect(() => { const fetchData = async () => { const res = await axios(API_URL); let data = await res.data; data.map((e) => availableDateList.push(e.date)); }; fetchData(); setAvailableDateListClass(); }, []); const calenderRenderHandling = (e) => { setAvailableDateListClass(); }; return ( <> <FullCalendar plugins={[dayGridPlugin, interactionPlugin]} initialView="dayGridMonth" events={callenderEvents} eventOverlap={false} datesSet={calenderRenderHandling} /> </> ); }; export default Calender;
 "axios": "^0.27.2", "react": "^18.1.0", "react-dom": "^18.1.0", "react-scripts": "^5.0.1", "@fullcalendar/daygrid": "^5.11.0", "@fullcalendar/interaction": "^5.11.0", "@fullcalendar/react": "^5.11.1",
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!