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

193
Views
React player no actualiza className en el cambio de estado

Estoy creando una aplicación que agrega una transmisión cada vez que un usuario busca una (hasta cuatro jugadores en una página). Quiero cambiar el estilo en función de cuántos jugadores tengo. Estoy usando mi estado searchedStreams. la longitud como condición. Mi problema es que después de buscar una segunda transmisión, la clase contenedora se actualiza correctamente, pero el nombre de clase de ReactPlayer en el primer reproductor no se actualiza.

 const ctx = useContext(ThemeContext); const stylesWrapper = `${ ctx.searchedStreams.length === 1 ? `${classes.wrapperOneStream}` : "" } ${ctx.searchedStreams.length === 2 ? `${classes.wrapperTwoStreams}` : ""}${ ctx.searchedStreams.length === 3 ? `${classes.wrapperThreeStreams}` : "" }`; const stylesPlayer = `${ ctx.searchedStreams.length === 1 ? `${classes.player1}` : "" } ${ctx.searchedStreams.length === 2 ? `${classes.player2}` : ""} ${ ctx.searchedStreams.length === 3 ? `${classes.player3}` : "" }`; return ( <Fragment> {ctx.searchedStreams.map((label) => ( <div className={stylesWrapper} key={label}> <ReactPlayer key={label} className={stylesPlayer} url={`https://www.twitch.tv/${label}`} width="100%" theme="dark" playing={true} /> </div> ))} </Fragment> );

ingrese la descripción de la imagen 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!